veryDeepCopy
Ted Kaehler
Ted at SqueakLand.org
Thu Oct 4 20:36:21 UTC 2001
Jim and all,
I am responsible for all those veryDeepCopyXXX messages.
Yes, they should probably be named structureCopy.
When a tree of objects points at an object outside of the
intended tree, that object should not be copied. veryDeepCopy has
its own kind of weak pointers for the 'potentially outside' objects.
If I duplicate this object, does that mean that I also want
to make duplicates of everything it holds onto? If yes, (i.e. a
Paragraph does want a new copy of its Text) then do nothing. If no,
(i.e. an undo command does not want to copy the objects it acts
upon), then define veryDeepInner: and veryDeepFixupWith:.
If the new instance variable (called foo) DOES want to be deep
copied, put this into any existing veryDeepInner: method in that class
foo _ foo veryDeepCopyWith: deepCopier.
If the new instance variable (called foo) does NOT want to be deep
copied, make sure the method veryDeepInner: is in that class, and add
this line:
foo _ foo.
(This signals to the checker that all is well.) Create a
veryDeepFixup: method for your class, and do what is normal there for
weakly copied variables.
--------
Jim,
The message you got is from a different kind of check.
Copying a Player class in DeepCopier>>mapUniClasses depends on Model
class staying the same size. That is why I check for any new inst
vars in Model class. Looking over that method now, I see that it
does not need to care about Model. I will rewrite it and submit an
update. The check on Model class will disappear.
For now, just don't use any Players. Don't paint a picture
and bring up a "Viewer" on it and give it behavior. You probably
were not doing this anyway.
--Ted.
At 7:37 PM -0700 10/3/01, Jim Benson wrote:
>Ok, I got lost. I want to add a class instance variable to the class Model.
>So far so good.
>
>What am I supposed to do to make this work correctly?
>
--
Ted Kaehler http://www.squeakland.org/~ted/
Job applicant: "I have a special talent. I can read people's minds."
Interviewer: "Then I don't need to tell you why we can't use you..."
More information about the Squeak-dev
mailing list
|