<?xml version="1.0" encoding="windows-1252"?>
<node id="1018663" title="Re^6: Real life uses for closures. (update: disambiguation)" created="2013-02-13 19:04:25" updated="2013-02-13 19:04:25">
<type id="11">
note</type>
<author id="171588">
BrowserUk</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;I agree and as I said closures are somehow the other side of the OO coin in allowing encapsulated variables.&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;Indeed. [193628|One of my very early posts here] was a OO class that used closures to produce a JS-style prototypical OO mechanism.

&lt;p&gt;Looking back at it I'm not sure it'll win any plaudits for maintainability, but it was a great tool for learning the power and limitations of closures.

&lt;blockquote&gt;&lt;i&gt;
It's like saying why do we need lexical variables, as long as we care about chosing the right package-namespaces we can achieve the same. 
&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;I appreciate the analogy, but if you look back, I wasn't reaching any conclusions with my thoughts about closures, just examining the evidence.

&lt;p&gt;As with many other ideas that suddenly gain currency -- despite usually having been around in one form or another since the '60s or early '70s -- I like to examine 'new ideas' every so often and try to see through the theory-wash, marketing speak and hyperbole, and reach my own conclusions as to their usefulness and importance.

&lt;P&gt;Through this process I have avoided getting swept alone by many a fad that has subsequently shown itself to be of dubious value. I tend to apply the same criteria to most everything in life.

&lt;p&gt;As far as closures go; I think I reached the conclusion that they are a valuable addition to languages so long as their implementation does not exact too high a price on the performance of the rest of that language.

&lt;p&gt;Done right, they are a useful addition to the toolbox; but I wouldn't want to throw out (or ham-string performance-wise) too many of the other tools in the box to accommodate them.

&lt;p&gt;Continuation passing on the other hand seems to exact too high a price.

&lt;blockquote&gt;&lt;i&gt;I think it's also part of the feature competition. &lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;That's essentially what I was wondering. Are closures just another 'we must have that too' kick. 

&lt;p&gt;I think they are somewhat more than that.

&lt;blockquote&gt;&lt;i&gt;
Saying this you might have noticed that some participants in this thread didn't really know what closure.
&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;Indeed. But that is also true of many a dissertation on them that you'll find online.

&lt;P&gt;But when I first encountered SmallTalk's &lt;i&gt;block arguments&lt;/i&gt;; their significance was lost on me also.




&lt;div class="pmsig"&gt;&lt;div class="pmsig-171588"&gt;
&lt;hr /&gt;
&lt;font size=1 &gt;
&lt;div&gt;With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'&lt;/div&gt;
&lt;div&gt;Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.&lt;/div&gt;
&lt;div&gt;"Science is about questioning the status quo. Questioning authority". &lt;/div&gt;
&lt;div&gt;In the absence of evidence, opinion is indistinguishable from prejudice.
&lt;/div&gt;
&lt;/font&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1018281</field>
<field name="parent_node">
1018658</field>
</data>
</node>
