Am I inferring correctly that you are saying closure consumes a constant factor of memory over struct, but otherwise doesn't necessarily hold onto unnecessarily references from the stack? <br><br>Any other way besides closure & struct to create opaque compound value objects?
<br><br>Thanks,<br>yinso <br><br><div><span class="gmail_quote">On 5/31/07, <b class="gmail_sendername">Robby Findler</b> <<a href="mailto:robby@cs.uchicago.edu">robby@cs.uchicago.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The size of a closure is proportional to the number of free variables<br>in the function. A struct with an equivalent number of slots uses less<br>memory, however.<br><br>Robby<br><br>On 5/31/07, YC <<a href="mailto:yinso.chen@gmail.com">
yinso.chen@gmail.com</a>> wrote:<br>><br>> On 5/31/07, Carl Eastlund <<a href="mailto:cce@ccs.neu.edu">cce@ccs.neu.edu</a>> wrote:<br>> > > In principle, a closure is essentially a struct. All that needs to be
<br>> > > stored is a code pointer and references to any free variables. How<br>> > > efficient this is in practice depends a lot on the particular<br>> > > implementation. Are you asking in general, or about PLT Scheme
<br>> > > specifically?<br>><br>> I am specifically interested in PLT Scheme (general info is also of interest<br>> but secondary).<br>><br>> Does closure hold references to the stack? I've heard that Scheme doesn't
<br>> keep variables on the stack, but want to verify.<br>><br>> If closure is as efficient as a struct that's great - I am finding myself<br>> leaning toward closure because it can be created anonymously and ad hoc, but
<br>> doing so with struct is a lot harder.<br>><br>> Thanks,<br>> yinso<br>><br>><br>> _________________________________________________<br>> For list-related administrative tasks:<br>> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">
http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>><br>><br></blockquote></div><br>