help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: last tests patch for a while -- ParseTreeRewriter


From: Stephen Compall
Subject: [Help-smalltalk] Re: last tests patch for a while -- ParseTreeRewriter
Date: Tue, 22 May 2007 19:19:00 -0500

On Tue, 2007-05-22 at 10:17 +0200, Paolo Bonzini wrote:
> -         newValue := oldContext at: key put: value "deepCopy <<<".
> +         newValue := oldContext at: key put: value deepCopy "<<<".

Quick postscript on this: I originally used `value collect: [:each |
each copy]' instead of deepCopy because value may be a node instead of a
list of nodes.  (RBProgramNode has 'collect: aBlock  ^aBlock value:
self'.)  So deepCopy copies the 'parent' instvar, which copies the value
and everything else in its tree.

The duplicate tree becomes garbage once the copied node is inserted back
into the original tree, but I thought it was worth avoiding anyway.  In
very rare cases, copying the parent's tree might cause problems with
rewriters computed under #recusivelySearchInContext.

-- 
;;; Stephen Compall ** http://scompall.nocandysw.com/blog **
Failure to imagine vast possibilities usually stems from a lack of
imagination, not a lack of possibility.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]