[Glass] How bad is to hold into closures?

James Foster james.foster at gemtalksystems.com
Fri Dec 6 05:34:45 PST 2013


Mariano,

In general, a compiled method or block (closure) will reference the Association that holds a global (including a Class). If you replace an existing global/class with a new one (version), then the code will pick up the current value from the Association. If you remove a key from the SymbolDictionary and add the key back then you get a new Association, and the old code references the old Association (until it is recompiled) and your old code will reference the old global/class. (This can be very confusing to debug!)

For some optimization hints (including a discussion of blocks), see pages 314-15 of the Programming Guide. 

James

On Dec 6, 2013, at 5:10 AM, Mariano Martinez Peck <marianopeck at gmail.com> wrote:

> Hi,
> 
> I have some objects that get persisted that have closures. From this perspective, I have a few questions. 
> 
> 1) I think that keeping pointers to classes in closures is bad right? (I general, holding pointers to classes is a bad idea because of the different versions etc)
> 
> 2) If the block is "clean" or self contained, the transitive closure you end up persisting is small right? I mean, you don't write the method, and the context, and the sender and the sender and...the whole stack. 
> 
> 3) Any other thing I should care when persisting closures?
> 
> Thanks, 
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20131206/b6701d84/attachment.html>


More information about the Glass mailing list