<?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: real closures</title>
	<atom:link href="http://sob.apotheon.org/?feed=rss2&#038;p=389" rel="self" type="application/rss+xml" />
	<link>http://sob.apotheon.org/?p=389</link>
	<description>[ scion of backronymics ]</description>
	<lastBuildDate>Thu, 02 Sep 2010 20:32:00 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: apotheon</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344447</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Thu, 01 May 2008 00:44:25 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344447</guid>
		<description>. . . which would be great if they actually made your point.  They don&#039;t.</description>
		<content:encoded><![CDATA[<p>. . . which would be great if they actually made your point.  They don't.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344424</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Wed, 30 Apr 2008 23:47:04 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344424</guid>
		<description>I&#039;m just picking from the first page of a Google search results for articles that say it in different words and illustrate it in different ways, so you might understand where you went wrong adding an unnecessary restriction to your definition.</description>
		<content:encoded><![CDATA[<p>I'm just picking from the first page of a Google search results for articles that say it in different words and illustrate it in different ways, so you might understand where you went wrong adding an unnecessary restriction to your definition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apotheon</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344419</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Wed, 30 Apr 2008 23:32:22 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344419</guid>
		<description>Using your links . . .

From [c2](http://c2.com/cgi/wiki?LexicalClosure):

&gt; Each time TWO-FUNS is called, each lambda expression is evaluated to produce a closure. The two closures are returned as a list of two elements. A different lexical environment is in effect each time, in which the name X is bound to a value. The two closures share the binding of X. However, each call to TWO-FUNS results in a new lexical environment, so that the binding of X used by the closures in FUNS1 is distinct from the bindings of X used by the closures in FUNS2.

From [Wikipedia](http://en.wikipedia.org/wiki/Closure_%28computer_science%29):

&gt; The scope of the variable encompasses only the closed-over function, so it cannot be accessed from other program code.

From [UCSD](http://www.cs.ucsd.edu/~clbailey/ClosureOverview.htm):

&gt; An important part of closure is that when we say that the set is &quot;closed under&quot; an operation, it has to be true for everything in the set. So even if all kinds of candies--except for one--were still candy after the bird() operation, Candy would still not be closed under bird(). Next is an example of closure that is more formal.

These strike me as serving as potential counterarguments to what you seem to be trying to say.

In any case, your argument seems to be &quot;None of these pages I&#039;ve picked out *explicitly* contradicts me, so I&#039;m right!&quot;  I don&#039;t find that a convincing argument.</description>
		<content:encoded><![CDATA[<p>Using your links .&nbsp;.&nbsp;.</p>
<p>From <a href="http://c2.com/cgi/wiki?LexicalClosure">c2</a>:</p>
<blockquote>
<p>Each time TWO-FUNS is called, each lambda expression is evaluated to produce a closure. The two closures are returned as a list of two elements. A different lexical environment is in effect each time, in which the name X is bound to a value. The two closures share the binding of X. However, each call to TWO-FUNS results in a new lexical environment, so that the binding of X used by the closures in FUNS1 is distinct from the bindings of X used by the closures in FUNS2.</p>
</blockquote>
<p>From <a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29">Wikipedia</a>:</p>
<blockquote>
<p>The scope of the variable encompasses only the closed-over function, so it cannot be accessed from other program code.</p>
</blockquote>
<p>From <a href="http://www.cs.ucsd.edu/~clbailey/ClosureOverview.htm">UCSD</a>:</p>
<blockquote>
<p>An important part of closure is that when we say that the set is "closed under" an operation, it has to be true for everything in the set. So even if all kinds of candies&#8211;except for one&#8211;were still candy after the bird() operation, Candy would still not be closed under bird(). Next is an example of closure that is more formal.</p>
</blockquote>
<p>These strike me as serving as potential counterarguments to what you seem to be trying to say.</p>
<p>In any case, your argument seems to be "None of these pages I've picked out <em>explicitly</em> contradicts me, so I'm right!"  I don't find that a convincing argument.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344408</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Wed, 30 Apr 2008 23:14:39 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344408</guid>
		<description>Did I not say close over the scope a million times, or is someone else leaving comments in my name?

Here&#039;s a bunch of definitions (you can Google for more) that all say the exact same thing:
http://c2.com/cgi/wiki?LexicalClosure
http://www.jibbering.com/faq/faq\_notes/closures.html
http://www.learnthat.com/define/view.asp?id=3938
[http://en.wikipedia.org/wiki/Closure\_&#40;computer\_science&#41;](http://en.wikipedia.org/wiki/Closure_%28computer_science%29)

Or if you&#039;re more inclined, you might want to imagine how this came about from closures in algebra:
http://www.cs.ucsd.edu/~clbailey/ClosureOverview.htm</description>
		<content:encoded><![CDATA[<p>Did I not say close over the scope a million times, or is someone else leaving comments in my name?</p>
<p>Here's a bunch of definitions (you can Google for more) that all say the exact same thing:<br />
<a href="http://c2.com/cgi/wiki?LexicalClosure" rel="nofollow">http://c2.com/cgi/wiki?LexicalClosure</a><br />
<a href="http://www.jibbering.com/faq/faq_notes/closures.html" rel="nofollow">http://www.jibbering.com/faq/faq_notes/closures.html</a><br />
<a href="http://www.learnthat.com/define/view.asp?id=3938" rel="nofollow">http://www.learnthat.com/define/view.asp?id=3938</a><br />
<a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29"></a><a href="http://en.wikipedia.org/wiki/Closure_&#40;computer_science&#41" rel="nofollow">http://en.wikipedia.org/wiki/Closure_&#40;computer_science&#41</a>;</p>
<p>Or if you're more inclined, you might want to imagine how this came about from closures in algebra:<br />
<a href="http://www.cs.ucsd.edu/~clbailey/ClosureOverview.htm" rel="nofollow">http://www.cs.ucsd.edu/~clbailey/ClosureOverview.htm</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apotheon</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344377</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Wed, 30 Apr 2008 22:08:37 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344377</guid>
		<description>&gt; I don&#039;t because it doesn&#039;t matter.

So -- you&#039;re saying closures are the exact same thing as a first-class function in a language with global scope.  The mind boggles.</description>
		<content:encoded><![CDATA[<blockquote>
<p>I don't because it doesn't matter.</p>
</blockquote>
<p>So &#8212; you're saying closures are the exact same thing as a first-class function in a language with global scope.  The mind boggles.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344362</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Wed, 30 Apr 2008 21:03:23 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344362</guid>
		<description>I don&#039;t because it doesn&#039;t matter.  If you&#039;re saying that in some code paths a closure would be indistinguishable from nested scoping, you&#039;re right.  In other code paths, where it never gets called, a closure is indistinguishable from noop.  Still is a closure.</description>
		<content:encoded><![CDATA[<p>I don't because it doesn't matter.  If you're saying that in some code paths a closure would be indistinguishable from nested scoping, you're right.  In other code paths, where it never gets called, a closure is indistinguishable from noop.  Still is a closure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apotheon</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344355</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Wed, 30 Apr 2008 20:49:21 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344355</guid>
		<description>&gt; Actually, the anonymous function doesn&#039;t have access to the larger scope. It only has access to variable bindings that existed there when it closed over it.

Thanks for pedantically missing my point.

&gt; What happens in the larger scope afterwards is none of its business:

Maybe so -- but you have yet to suggest a situation where the parent scope staying open isn&#039;t identical to just using variables with global scope, for purposes of a hypothetical closure.</description>
		<content:encoded><![CDATA[<blockquote>
<p>Actually, the anonymous function doesn't have access to the larger scope. It only has access to variable bindings that existed there when it closed over it.</p>
</blockquote>
<p>Thanks for pedantically missing my point.</p>
<blockquote>
<p>What happens in the larger scope afterwards is none of its business:</p>
</blockquote>
<p>Maybe so &#8212; but you have yet to suggest a situation where the parent scope staying open isn't identical to just using variables with global scope, for purposes of a hypothetical closure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344352</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Wed, 30 Apr 2008 20:38:25 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344352</guid>
		<description>Actually, the anonymous function doesn&#039;t have access to the larger scope.  It only has access to variable bindings that existed there when it closed over it.  What happens in the larger scope afterwards is none of its business:

x = 1
lambda { x = 2; y = 3 }.call
puts x
puts y rescue puts &#039;no y&#039;
y = 4
puts y</description>
		<content:encoded><![CDATA[<p>Actually, the anonymous function doesn't have access to the larger scope.  It only has access to variable bindings that existed there when it closed over it.  What happens in the larger scope afterwards is none of its business:</p>
<p>x = 1<br />
lambda { x = 2; y = 3 }.call<br />
puts x<br />
puts y rescue puts 'no y'<br />
y = 4<br />
puts y</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apotheon</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344343</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Wed, 30 Apr 2008 20:26:41 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344343</guid>
		<description>&gt; When you use a block, it creates an anonymous function and closes over the enclosing scope. That&#039;s the closure.

I don&#039;t see how &quot;closes over the enclosing scope&quot; has any meaning other than &quot;I&#039;m trying to come up with a way to sound credible when I suggest that the parent scope doesn&#039;t have to close to create a closure.&quot;  The nested scope doesn&#039;t &quot;close over&quot; its context.  It exists *within* its context, and can access it if that context is lexical or global.  If it&#039;s lexical, and the parent scope closes, the nested scope still has access to that context -- unless the nested scope no longer exists.  It&#039;s almost tautological.

&gt; It allows the other scope to die, and the closure to still access those bound variables, but it doesn&#039;t require the other scope to ever die.

If the parent scope doesn&#039;t die, it&#039;s not a closure -- it&#039;s a nested function (or local linguistic equivalent of a function, for the pedants in the audience).

Otherwise, you&#039;re just talking about what global and lexical scope have in common.

I suppose one might conceivably suggest that a closure could exist without the parent scope having closed, in some hypothetical language where a function can have a return value without closing, but as far as I&#039;m aware such a language doesn&#039;t exist.</description>
		<content:encoded><![CDATA[<blockquote>
<p>When you use a block, it creates an anonymous function and closes over the enclosing scope. That's the closure.</p>
</blockquote>
<p>I don't see how "closes over the enclosing scope" has any meaning other than "I'm trying to come up with a way to sound credible when I suggest that the parent scope doesn't have to close to create a closure."  The nested scope doesn't "close over" its context.  It exists <em>within</em> its context, and can access it if that context is lexical or global.  If it's lexical, and the parent scope closes, the nested scope still has access to that context &#8212; unless the nested scope no longer exists.  It's almost tautological.</p>
<blockquote>
<p>It allows the other scope to die, and the closure to still access those bound variables, but it doesn't require the other scope to ever die.</p>
</blockquote>
<p>If the parent scope doesn't die, it's not a closure &#8212; it's a nested function (or local linguistic equivalent of a function, for the pedants in the audience).</p>
<p>Otherwise, you're just talking about what global and lexical scope have in common.</p>
<p>I suppose one might conceivably suggest that a closure could exist without the parent scope having closed, in some hypothetical language where a function can have a return value without closing, but as far as I'm aware such a language doesn't exist.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344339</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Wed, 30 Apr 2008 20:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344339</guid>
		<description>When you use a block, it creates an anonymous function and closes over the enclosing scope.  That&#039;s the closure.   The anonymous function has a scope that&#039;s independent of the scope in which it was defined, but can still access the same bound variables.  That independence is what closures are about.  It allows the other scope to die, and the closure to still access those bound variables, but it doesn&#039;t require the other scope to ever die.  Independence is achieved when you&#039;re no longer affected by what happens elsewhere, whether or not something happens elsewhere is immaterial, because you&#039;re no longer dependent on it.</description>
		<content:encoded><![CDATA[<p>When you use a block, it creates an anonymous function and closes over the enclosing scope.  That's the closure.   The anonymous function has a scope that's independent of the scope in which it was defined, but can still access the same bound variables.  That independence is what closures are about.  It allows the other scope to die, and the closure to still access those bound variables, but it doesn't require the other scope to ever die.  Independence is achieved when you're no longer affected by what happens elsewhere, whether or not something happens elsewhere is immaterial, because you're no longer dependent on it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apotheon</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344338</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Wed, 30 Apr 2008 20:03:53 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344338</guid>
		<description>So, basically, you&#039;re saying &quot;Scope closes, but I&#039;m not going to show it.&quot;  Okay.

What about the case where the parent scope *doesn&#039;t* close?  In such a case, the block does *not* get its context closed around it, and doesn&#039;t become a closure.</description>
		<content:encoded><![CDATA[<p>So, basically, you're saying "Scope closes, but I'm not going to show it."  Okay.</p>
<p>What about the case where the parent scope <em>doesn't</em> close?  In such a case, the block does <em>not</em> get its context closed around it, and doesn't become a closure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344332</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Wed, 30 Apr 2008 19:37:54 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344332</guid>
		<description>Of course it did, they all do.  This might be a snippet from a larger function which defines the scope.  Or maybe a test.rb Ruby file, in which case the scope is created with require/load and discarded the moment require/load is done evaluating the file.</description>
		<content:encoded><![CDATA[<p>Of course it did, they all do.  This might be a snippet from a larger function which defines the scope.  Or maybe a test.rb Ruby file, in which case the scope is created with require/load and discarded the moment require/load is done evaluating the file.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apotheon</title>
		<link>http://sob.apotheon.org/?p=389&#038;cpage=1#comment-344326</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Wed, 30 Apr 2008 19:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://sob.apotheon.org/?p=389#comment-344326</guid>
		<description>. . . except that the enclosing scope never closed, because it&#039;s the (effectively) global scope.</description>
		<content:encoded><![CDATA[<p>. . . except that the enclosing scope never closed, because it's the (effectively) global scope.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
