<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Five things I learnt about Javascript this month</title>
	<atom:link href="http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/</link>
	<description>Software Development in Brisbane</description>
	<lastBuildDate>Fri, 03 Feb 2012 20:00:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: robert</title>
		<link>http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/comment-page-1/#comment-896</link>
		<dc:creator>robert</dc:creator>
		<pubDate>Thu, 26 Apr 2007 02:07:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/#comment-896</guid>
		<description>Thanks for the info Tom.  I&#039;ve made an update to warn people not to take the python/javascript analogy too far.</description>
		<content:encoded><![CDATA[<p>Thanks for the info Tom.  I&#8217;ve made an update to warn people not to take the python/javascript analogy too far.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Palmer</title>
		<link>http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/comment-page-1/#comment-893</link>
		<dc:creator>Tom Palmer</dc:creator>
		<pubDate>Tue, 24 Apr 2007 02:37:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/#comment-893</guid>
		<description>Sorry. I was in a rush. Here are examples. Python:

onSubmit = form.onSubmit
onSubmit() # Passes in the correct &#039;self&#039;.
unboundOnSubmit = Form.onSubmit
unboundOnSubmit(form) # Requires explicit &#039;self&#039; parameter.

JavaScript:

form.onSubmit(); // Passes in the correct &#039;this&#039;.
var onSubmit = form.onSubmit;
onSubmit(); // Leaves &#039;this&#039; undefined.
onSubmit.apply(form); // Requires explicit &#039;this&#039; when called this way.</description>
		<content:encoded><![CDATA[<p>Sorry. I was in a rush. Here are examples. Python:</p>
<p>onSubmit = form.onSubmit<br />
onSubmit() # Passes in the correct &#8216;self&#8217;.<br />
unboundOnSubmit = Form.onSubmit<br />
unboundOnSubmit(form) # Requires explicit &#8216;self&#8217; parameter.</p>
<p>JavaScript:</p>
<p>form.onSubmit(); // Passes in the correct &#8216;this&#8217;.<br />
var onSubmit = form.onSubmit;<br />
onSubmit(); // Leaves &#8216;this&#8217; undefined.<br />
onSubmit.apply(form); // Requires explicit &#8216;this&#8217; when called this way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: robert</title>
		<link>http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/comment-page-1/#comment-892</link>
		<dc:creator>robert</dc:creator>
		<pubDate>Tue, 24 Apr 2007 01:50:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/#comment-892</guid>
		<description>Tom -- OK it does help when thinking about things in some way.  Perhaps I am getting the words wrong, but JavaScript does use the this.  I&#039;m not the greatest functional programmer, and don&#039;t know the theory/jargon as well as some, so the first thing that pops to mind when I hear the word &quot;curry&quot; is a good Indian meal.

For me thinking in terms of pythons self, where the self reference gets automagically passed by the interpreter helped my understanding.  The thing with python is that the self parameter is explicate in methods, in JavaScript it isn&#039;t so in thinking through the idea of how this works, the concept of self helps to understand, while of course it won&#039;t be exactly the same.


Adam -- You are right of course.  I didn&#039;t mean to give the impression that new Function is a good approach.  Some of the examples that I have seen of it are much better served by the lowercase function approach (which I mentioned above in the prototype example).</description>
		<content:encoded><![CDATA[<p>Tom &#8212; OK it does help when thinking about things in some way.  Perhaps I am getting the words wrong, but JavaScript does use the this.  I&#8217;m not the greatest functional programmer, and don&#8217;t know the theory/jargon as well as some, so the first thing that pops to mind when I hear the word &#8220;curry&#8221; is a good Indian meal.</p>
<p>For me thinking in terms of pythons self, where the self reference gets automagically passed by the interpreter helped my understanding.  The thing with python is that the self parameter is explicate in methods, in JavaScript it isn&#8217;t so in thinking through the idea of how this works, the concept of self helps to understand, while of course it won&#8217;t be exactly the same.</p>
<p>Adam &#8212; You are right of course.  I didn&#8217;t mean to give the impression that new Function is a good approach.  Some of the examples that I have seen of it are much better served by the lowercase function approach (which I mentioned above in the prototype example).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Connor</title>
		<link>http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/comment-page-1/#comment-891</link>
		<dc:creator>Adam Connor</dc:creator>
		<pubDate>Tue, 24 Apr 2007 00:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/#comment-891</guid>
		<description>Function is an expensive way of creating functions at runtime, and really only makes sense if there are no alternatives (which there usually are). Use the lowercase function (and no new) to more cheaply, e.g. myFunction = function(arg1, arg2){alert(arg1 + arg2);};</description>
		<content:encoded><![CDATA[<p>Function is an expensive way of creating functions at runtime, and really only makes sense if there are no alternatives (which there usually are). Use the lowercase function (and no new) to more cheaply, e.g. myFunction = function(arg1, arg2){alert(arg1 + arg2);};</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Palmer</title>
		<link>http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/comment-page-1/#comment-890</link>
		<dc:creator>Tom Palmer</dc:creator>
		<pubDate>Tue, 24 Apr 2007 00:42:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/2007/04/23/five-things-i-learnt-about-javascript-this-month/#comment-890</guid>
		<description>Actually, Python and JavaScript are different in how they handle self/this. Python curries/binds the this, and JavaScript forgets it.</description>
		<content:encoded><![CDATA[<p>Actually, Python and JavaScript are different in how they handle self/this. Python curries/binds the this, and JavaScript forgets it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

