<br><br><div class="gmail_quote">On Fri, Dec 2, 2011 at 11:59 AM, 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;">
Mariano Martinez Peck 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 9:46 PM, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a> &lt;mailto:<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.<u></u>com</a>&gt;&gt; wrote:<br>

<br>
<br>
<br>
    On Fri, Dec 2, 2011 at 12:40 PM, Mariano Martinez Peck<br></div><div class="im">
    &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>
<br>
<br>
        On Fri, Dec 2, 2011 at 8:30 PM, Juan Vuletich<br></div><div class="im">
        &lt;<a href="mailto:juan@jvuletich.org" target="_blank">juan@jvuletich.org</a> &lt;mailto:<a href="mailto:juan@jvuletich.org" target="_blank">juan@jvuletich.org</a>&gt;&gt; wrote:<br>
<br>
            Eliot Miranda wrote:<br>
<br>
<br>
<br>
                On Fri, Dec 2, 2011 at 10:55 AM, Mariano Martinez Peck<br>
                &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;<br></div>
                &lt;mailto:<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a><div><div></div><div class="h5"><br>
                &lt;mailto:<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt;<u></u>&gt;&gt; wrote:<br>
<br>
                   Thanks both. I am right to assume that if the block<br>
                refers to temp<br>
                   vars, parameters, or whatever in another scope,<br>
                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:<br>
                (SortedCollection<br>
                   sortBlock: [:a :b | (a + blah) &gt; b ]).<br>
<br>
                   Then the &#39;blah&#39; is in a different context. So the<br>
                mentioned<br>
                   solution works for &quot;clean&quot; closures, which are<br>
                &quot;self contained&quot;.<br>
                   In the other cases (such as this example), we<br>
                should serialize the<br>
                   whole stack. Is this correct?<br>
<br>
<br>
                No.  The closure implementation arranges that any and<br>
                all temporary variables accessed by the closure are<br>
                directly accessible from the closure without accessing<br>
                the outer contexts.<br>
                 ...<br>
<br>
<br>
            WRT clean closures, check what I did in Cuis to serialize<br>
            SortedCollections. See implementors and senders of #isClean.<br>
<br>
<br>
        Nice. Thanks Juan. I was checking your code, and that&#39;s<br>
        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<br>
        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<br>
        be able to serialize also &quot;non clean&quot;.<br>
<br>
<br>
    IMO, dy default, everything reachable from the closure, including<br>
    the outerContext chain and their senders.  But that&#39;s only a<br>
    default.  What makes sense in any given context is up to the<br>
    application, e.g. see Seaside.  One size won&#39;t fit all.  You<br>
    should handle the common cases (e.g. clean blocks and everything<br>
    else) and leave it up to the user to figure out what they need to<br>
    do in complex situations, making sure you provide them with the<br>
    hooks they&#39;ll need, such as the ability to substitute objects when<br>
    serializing etc, and perhaps some useful examples.<br>
<br>
<br>
+1   Then we will do the following: we will check whether the closure is clean. If it is, then we serialize just the closure plus its outerContext but only with receiver and method. If it is not clean, then we serialize the whole stack. That&#39;s all by default. If then someone needs something different, then to use the hooks :)<br>

So the final question is whether what Juan is using in Cuis is up to date. If it is, then I have all I need :)<br>
Thank you guys.<br>
</div></div></blockquote>
<br>
I can say that it does indeed work. But I&#39;d be really grateful if Eliot took a good look at that code!<br></blockquote><div><br></div><div>OK, will do :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
Cheers,<br>
Juan Vuletich<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
 <br>
<br>
        I mean, for each item on that list, what do I need apart from<br>
        the closure instance and the receiver and method from the<br>
        outerContext ?  the whole stack of contexts ?<br>
<br>
<br>
        Thanks a lot in advance!<br>
<br>
<br>
<br>
        --         Mariano<br>
        <a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
    --     best,<br>
    Eliot<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
-- <br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a><br>
<br></div>
------------------------------<u></u>------------------------------<u></u>------------<br>
<br>
<br>
  <br>
------------------------------<u></u>------------------------------<u></u>------------<br>
<br>
No virus found in this message.<br>
Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a> &lt;<a href="http://www.avg.com" target="_blank">http://www.avg.com</a>&gt;<br>
Version: 10.0.1411 / Virus Database: 2102/4052 - Release Date: 12/02/11<br>
<br>
</blockquote>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>