<br><br><div class="gmail_quote">On Fri, Dec 2, 2011 at 8:30 PM, Juan Vuletich <span dir="ltr">&lt;<a href="mailto:juan@jvuletich.org">juan@jvuletich.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Eliot Miranda wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<br>
On Fri, Dec 2, 2011 at 10:55 AM, Mariano Martinez Peck &lt;<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a> &lt;mailto:<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt;<u></u>&gt; wrote:<br>

<br>
    Thanks both. I am right to assume that if the block refers to temp<br>
    vars, parameters, or whatever in another scope, then such solution<br>
    won&#39;t work. I mean, if I have this example for example:<br>
<br>
    | bytes result blah |<br>
    blah := 42.<br>
    bytes := FLSerializer serializeToByteArray: (SortedCollection<br>
    sortBlock: [:a :b | (a + blah) &gt; b ]).<br>
<br>
    Then the &#39;blah&#39; is in a different context. So the mentioned<br>
    solution works for &quot;clean&quot; closures, which are &quot;self contained&quot;.<br>
    In the other cases (such as this example), we should serialize the<br>
    whole stack. Is this correct?<br>
<br>
<br>
No.  The closure implementation arranges that any and all temporary variables accessed by the closure are directly accessible from the closure without accessing the outer contexts.<br></div>
 ...<br>
</blockquote>
<br>
WRT clean closures, check what I did in Cuis to serialize SortedCollections. See implementors and senders of #isClean.<br>
<br></blockquote><div><br>Nice. Thanks Juan. I was checking your code, and that&#39;s exactly why I asked Eliot. In your method you say:<br><br>isClean<br>    &quot;A clean closure is one that doesn&#39;t really need the home context because:<br>
        - It doesn&#39;t send messages to self or super<br>        - It doesn&#39;t access any instance variable<br>        - It doesn&#39;t access any outer temp<br>        - It doesn&#39;t do ^ return&quot;<br>.....<br>
<br>So... my question is, WHAT do I need to serialize if I want to be able to serialize also &quot;non clean&quot;. I mean, for each item on that list, what do I need apart from the closure instance and the receiver and method from the outerContext ?  the whole stack of contexts ?<br>
<br><br>Thanks a lot in advance!</div></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>