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 [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
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 <[hidden email]> wrote:
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
In reply to this post by Mariano Martinez Peck
From: "Mariano Martinez Peck" <[hidden email]>As James points out, compiled references to classes are okay, since the compiled reference is to the association (which doesn't change with each version). The problem occurs when you have a variable-based reference to a class (class or instance variable ref). IN this case you are referencing the class directly and you run the risk of ending up referencing an older version of the class ... We don't keep the whole stack, but depending upon what variables are being referenced we do keep additional informaton around (variable contexts keep track of the information that we have to have) ... I think we have 9 different flavors of Block Closure in 3.x... You can inspect your closure and you should be able to see just what is being referenced from a particular block closure..
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Free forum by Nabble | Edit this page |