<?xml version="1.0" encoding="windows-1252"?>
<node id="1018597" title="Re^4: Real life uses for closures. (update: disambiguation)" created="2013-02-13 13:35:13" updated="2013-02-13 13:35:13">
<type id="11">
note</type>
<author id="171588">
BrowserUk</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;I've been reading a lot about constructing interpreters and VMs lately, and one thing that seems common to most new ones is the seemingly obligatory inclusion of closures; and the almost equally obligatory tales of woe, sleepless nights and extreme programming hardship that are required in order to implement them in an efficient and elegant manner.

&lt;p&gt;Then the thought that formed in my mind was that whilst I am [http://perlmonks.com/index.pl?abspart=1;displaytype=displaycode;node_id=405888;part=1|quite happy to make extensive use of them], I was also quite happily solving my programming problems in languages that don't support them for 15+ years before I became acquainted with them.

&lt;p&gt;So then the questions that came to me were: a) how much use do people make of them in Perl? b) How many of those uses are actually 'killer applications' of closures, rather than trivial or convenient uses of up-values in anonymous subroutines that could just as easily be done using some other mechanism that doesn't impose such demands upon the VM?

&lt;P&gt;One of the 'killer applications' of closures often cited in FP circles, is their links to continuation passing. But continuation passing is just one method of solving a problem that can be solved in various other ways. And most of those other ways seem to impose far less runtime burdens than CP whilst achieving the same goals.

&lt;p&gt;Hence my very open question to try and get a feel for what people do with closures in real-world code. 


&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">
1018579</field>
</data>
</node>
