<br><br><div class="gmail_quote">On Fri, Dec 2, 2011 at 8:30 PM, Juan Vuletich <span dir="ltr"><<a href="mailto:juan@jvuletich.org">juan@jvuletich.org</a>></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 <<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a> <mailto:<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>><u></u>> 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'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) > b ]).<br>
<br>
Then the 'blah' is in a different context. So the mentioned<br>
solution works for "clean" closures, which are "self contained".<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's exactly why I asked Eliot. In your method you say:<br><br>isClean<br> "A clean closure is one that doesn't really need the home context because:<br>
- It doesn't send messages to self or super<br> - It doesn't access any instance variable<br> - It doesn't access any outer temp<br> - It doesn't do ^ return"<br>.....<br>
<br>So... my question is, WHAT do I need to serialize if I want to be able to serialize also "non clean". 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>