[Glass] How bad is to hold into closures?

Dale K. Henrichs dale.henrichs at gemtalksystems.com
Fri Dec 6 07:54:24 PST 2013


----- Original Message -----

| From: "Mariano Martinez Peck" <marianopeck at gmail.com>
| To: glass at lists.gemtalksystems.com
| Sent: Friday, December 6, 2013 5:10:14 AM
| Subject: [Glass] How bad is to hold into closures?

| 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)

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 ... 

| 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.
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.. 

| 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/14e846f5/attachment.html>


More information about the Glass mailing list