<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-18241482.post4693246029392315693..comments</id><updated>2009-03-09T09:57:27.168-07:00</updated><title type='text'>Comments on Programming and Debugging (in my Underhøøsen): Reaching Closure...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://the-free-meme.blogspot.com/feeds/4693246029392315693/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/4693246029392315693/comments/default'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/02/reaching-closure.html'/><author><name>The Free Meme</name><uri>http://www.blogger.com/profile/08287129746971472910</uri><email>cristi.vlasceanu@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18241482.post-6048952423499985664</id><published>2009-03-09T05:26:00.000-07:00</published><updated>2009-03-09T05:26:00.000-07:00</updated><title type='text'>No, it's not boxing.C# has closures too, in the fo...</title><content type='html'>No, it&amp;#39;s not boxing.&lt;BR/&gt;C# has closures too, in the form of anonymous delegats since C# 2.0, and in the form of lambda expressions since C# 3.0. C#&amp;#39;s closure is similar to those in other languages, that it captures enclosing block&amp;#39;s environment.&lt;BR/&gt;&lt;BR/&gt;C# compiler implements closures in a few ways, determined by escape analysis.&lt;BR/&gt;The compiler checks if the closure captures &amp;quot;this&amp;quot; (that is to say, if it uses any member fields), and/or if it captures any local variables of the enclosing scope.&lt;BR/&gt;&lt;BR/&gt;If the closure captures neither of the two, or to say if all variables used within the closure are bound, then the compiler emits a private static method.&lt;BR/&gt;If it captures &amp;quot;this&amp;quot; but no local variables of the enclosing scope, then the compiler emits a private member method.&lt;BR/&gt;If it captures any local variables of the enclosing scope, then the compiler builds a compiler-generated nested class (with the name of something like &amp;quot;&amp;lt;&amp;gt;__CompilerGenerated1&amp;quot; to ensure no name collusion is possible). The anything the closure captures gets stored in an instance of the generated class, and the nested function becomes a method of the generated class.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/4693246029392315693/comments/default/6048952423499985664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/4693246029392315693/comments/default/6048952423499985664'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/02/reaching-closure.html?showComment=1236601560000#c6048952423499985664' title=''/><author><name>Krystal</name><uri>http://www.blogger.com/profile/04662893805833554832</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/02/reaching-closure.html' ref='tag:blogger.com,1999:blog-18241482.post-4693246029392315693' source='http://www.blogger.com/feeds/18241482/posts/default/4693246029392315693' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-6987649268007899794</id><published>2009-02-25T10:14:00.000-08:00</published><updated>2009-02-25T10:14:00.000-08:00</updated><title type='text'>Jonathan, are you referring to "boxing"? That's no...</title><content type='html'>Jonathan, are you referring to "boxing"? That's not what I had in mind...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/4693246029392315693/comments/default/6987649268007899794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/4693246029392315693/comments/default/6987649268007899794'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/02/reaching-closure.html?showComment=1235585640000#c6987649268007899794' title=''/><author><name>The Free Meme</name><uri>http://www.blogger.com/profile/08287129746971472910</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05942387056293398693'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/02/reaching-closure.html' ref='tag:blogger.com,1999:blog-18241482.post-4693246029392315693' source='http://www.blogger.com/feeds/18241482/posts/default/4693246029392315693' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-6426584235190066889</id><published>2009-02-24T19:08:00.000-08:00</published><updated>2009-02-24T19:08:00.000-08:00</updated><title type='text'>&gt; There may be at least another solution: wrap eac...</title><content type='html'>&amp;gt; There may be at least another solution: wrap each referenced variable into an object, and have both the nested function and the surrounding context share the object reference; &lt;BR/&gt;&lt;BR/&gt;That is how C# and VB do it. So far it hasn&amp;#39;t caused me too much pain.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/4693246029392315693/comments/default/6426584235190066889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/4693246029392315693/comments/default/6426584235190066889'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/02/reaching-closure.html?showComment=1235531280000#c6426584235190066889' title=''/><author><name>Jonathan Allen</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/02/reaching-closure.html' ref='tag:blogger.com,1999:blog-18241482.post-4693246029392315693' source='http://www.blogger.com/feeds/18241482/posts/default/4693246029392315693' type='text/html'/></entry></feed>