What is the proper implementation of BlockClosure>>veryDeepInner:?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

What is the proper implementation of BlockClosure>>veryDeepInner:?

Chris Muller-3
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..