<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Self-&#8221;partially applying&#8221; JavaScript functions</title>
	<link>http://www.barklund.org/blog/2008/02/06/self-partially-applying-javascript-functions/</link>
	<description>My life with ActionScript and relations</description>
	<pubDate>Wed, 07 Jan 2009 17:19:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Barklund</title>
		<link>http://www.barklund.org/blog/2008/02/06/self-partially-applying-javascript-functions/#comment-11315</link>
		<pubDate>Thu, 07 Feb 2008 08:42:54 +0000</pubDate>
		<guid>http://www.barklund.org/blog/2008/02/06/self-partially-applying-javascript-functions/#comment-11315</guid>
					<description>Hi James,

I've fixed the typo, and regarding your comment on &quot;to leak or not&quot;, I have come to the habit of never using the activation object for variables that need be accessed inside inner functions. In this case, neither &lt;code&gt;f&lt;/code&gt; nor &lt;code&gt;n&lt;/code&gt; can be DOM objects agreed (as they are &lt;em&gt;supposed&lt;/em&gt; to be a function and an integer respectively), but if I for the fun of it (and for the errors it will throw) invoke it with &lt;code&gt;n&lt;/code&gt; set to some DOM object, that I remove from the DOM afterwards, we might get a leak quite easily (not tested though).

Thus I have come to the habit of never using the activation object in such smaller helper functions, that are generalized to work on just about anything.</description>
		<content:encoded><![CDATA[<p>Hi James,</p>
<p>I&#8217;ve fixed the typo, and regarding your comment on &#8220;to leak or not&#8221;, I have come to the habit of never using the activation object for variables that need be accessed inside inner functions. In this case, neither <code>f</code> nor <code>n</code> can be DOM objects agreed (as they are <em>supposed</em> to be a function and an integer respectively), but if I for the fun of it (and for the errors it will throw) invoke it with <code>n</code> set to some DOM object, that I remove from the DOM afterwards, we might get a leak quite easily (not tested though).</p>
<p>Thus I have come to the habit of never using the activation object in such smaller helper functions, that are generalized to work on just about anything.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: James Coglan</title>
		<link>http://www.barklund.org/blog/2008/02/06/self-partially-applying-javascript-functions/#comment-11242</link>
		<pubDate>Wed, 06 Feb 2008 23:08:47 +0000</pubDate>
		<guid>http://www.barklund.org/blog/2008/02/06/self-partially-applying-javascript-functions/#comment-11242</guid>
					<description>Sorry, just realised my comment was ambiguous. By &quot;This has nothing to do with the DOM&quot;, I meant that partial function application (not memory leaks) has nothing to do with the DOM.</description>
		<content:encoded><![CDATA[<p>Sorry, just realised my comment was ambiguous. By &#8220;This has nothing to do with the DOM&#8221;, I meant that partial function application (not memory leaks) has nothing to do with the DOM.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: James Coglan</title>
		<link>http://www.barklund.org/blog/2008/02/06/self-partially-applying-javascript-functions/#comment-11240</link>
		<pubDate>Wed, 06 Feb 2008 23:06:39 +0000</pubDate>
		<guid>http://www.barklund.org/blog/2008/02/06/self-partially-applying-javascript-functions/#comment-11240</guid>
					<description>Quick typo fix: in your Prototype example, you need to call c.curry.apply() rather than method.curry.apply(), since 'method' is not defined in your version of my code. 

Interesting to see different approaches. I won't get into a debate about global functions, but I should point out that use of closures do not cause memory leaks. Memory leaks tend to be caused by circular references between JavaScript objects and DOM objects -- closures can make such references hard to spot, but they do not cause the leaks. This has nothing to do with the DOM, in fact I've just been running my method millions of times through Drip and it shows constant memory usage.</description>
		<content:encoded><![CDATA[<p>Quick typo fix: in your Prototype example, you need to call c.curry.apply() rather than method.curry.apply(), since &#8216;method&#8217; is not defined in your version of my code. </p>
<p>Interesting to see different approaches. I won&#8217;t get into a debate about global functions, but I should point out that use of closures do not cause memory leaks. Memory leaks tend to be caused by circular references between JavaScript objects and DOM objects &#8212; closures can make such references hard to spot, but they do not cause the leaks. This has nothing to do with the DOM, in fact I&#8217;ve just been running my method millions of times through Drip and it shows constant memory usage.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
