[squeak-dev] What is the proper implementation of BlockClosure>>veryDeepInner:?

Chris Muller asqueaker at gmail.com
Sat Aug 10 20:15:18 UTC 2013


This might be a dumb question but..  Is there a case where it makes
sense to deepCopy a block?

I have a block being encountered in the graph of another object I'm
deepCopy'ing.  Since the BlockClosure makes no override of
veryDeepInner, the default implementation causes all of its instVars
to be deep-copied.

For my case, I know the block will not have external references, just
to its own temps, it would be sufficient to simply (shallow) copy just
the block itself, not its outerContext.

So I was tempted to add:

BlockClosure>>#veryDeepInner: aDeepCopier
     super veryDeepInner: aDeepCopier.

to the trunk so that, by its presence, cause its outerContext to be
shared with the copied block, rather than trying to deepCopy it.

It seems to meet my need for this case, but don't know whether it's
crazy for other cases..


More information about the Squeak-dev mailing list