[antlr-interest] Should dup() and dupXXXX() have shallow or deep clone semantics?

Ric Klaren klaren at cs.utwente.nl
Tue Nov 12 02:03:46 PST 2002


On Mon, Nov 11, 2002 at 11:24:08PM -0000, micheal_jor wrote:
> Just wondering aloud about this. I mean should object references
> inside the AST nodes just be copied or should the objects be cloned
> as well?
>
> What about object references to non-ANTLR types like String etc?
>
> I presume each call to dup()/dupXXX() be considered as making a
> separate clone of the object/object-graph so all cloned objects and
> cloned referenced objects must be unique across calls.

C++ mode uses deep copies in these modes. Also string are deep copied. If
you don't clone you may get funny things. (loops, trees that modify by
'themselves' etc.)

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
 Why don't we just invite them to dinner and massacre them all when they're
  drunk? You heard the man. There's seven hundred thousand of them. Ah? ..
           So it'd have to be something simple with pasta, then.
                 From: Interesting Times by Terry Pratchet


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list