[DGD]Sharing variables between cloned objects.

Thomas Annandale thomas at boredatheist.com
Thu May 3 09:15:44 CEST 2001


  I am looking for a way for two objects of the same type to share a
variable, so even if I clone two separate instances of them, the data in
the variable stays the same between all of the instances and is not
needlessly reproduced.  I know that in Java, you do this by declaring the
variable as "static", but this doesn't seem to work in dgd.

  Specifically, I want a mapping that is initialized with data once and
then left alone for the rest of its life.  A cloneable object will use
this mapping frequently.  I don't want every clone to have its own copy of
the mapping, as that seems like a big memory waste.  The only way I can
think to do this now is to make a separate object to store the mapping 
that all of the clones query whenever they need it.  Is there a better
way?


-Thomas
www.boredatheist.com


List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list