should Character override shallowCopy?
Lex Spoon
lex at cc.gatech.edu
Mon Feb 18 19:22:26 UTC 2002
Chris Muller <afunkyobject at yahoo.com> wrote:
>
> Squeak answers false to:
>
> $a shallowCopy == $a
>
> and is causing me some porting pain right now.
> shallowCopy was overridden for the other atomics;
> SmallIntegers, Booleans, the UndefinedObject and
> Symbols, but not Characters.
>
> Also, other Smalltalks override it for Behavior as
> well, which probably makes sense for the 99.9% case,
> and would also make my life happier right now.
Hmm, the comment of Object>>copy says:
"Answer another instance just like the receiver. Subclasses typically
override this method; they typically do not override shallowCopy."
It sounds like #copy is Do What I Mean, and #shallowCopy is Do What I
Say.
The case of Characters is pretty extreme, though: there really should be
only one $a. It would seem reasonable to override #shallowCopy for
Character. For classes, on the other hand, #shallowCopy makes more
sense: Smalltalk perfectly well allows you to build up your own class
objects, including copying them.
-Lex
More information about the Squeak-dev
mailing list
|