Who wants to refactor #deepCopy?

Stefan Matthias Aust sma at baltic-online.de
Tue May 30 11:43:08 UTC 2000


Henrik Gedenryd wrote:
> 
> Stefan Matthias Aust wrote:
> 
> > Anybody looked at copy, clone, deepCopy, veryDeepCopy recently?
> 
> > * I think, deepCopy doesn'T really work and only veryDeepCopy (a stupid
> > name, sorry) works.  So why it is still included?
> 
> > Look at Dolphin Smalltalk for a cleaner, IMHO much better implementation of
> > #deepCopy.
> 
> I always use vDC as I know it does the full job with handling shared
> instances and so on, never deepCopy. It's in the blue book, though, so it
> should probably not be removed. What's wrong with deepCopy in your view?

Being in the Blue Book is no reason to keep a method which - as you
said, too
- obviously doesn't work corectly for all cases.  I dislike the fact
that
instead of fixing it, there were introducted another set of methods
(vDC)

> #fullCopy seems to be an outdated predecessor of vDC though, and could
> probably be removed.

Yes, you're right.  I overlooked that method until now.

> > * What's that check-variables-every-10-minutes mess?! (see DeepCopier)
> 
> Since the project swapping mechanism relies on vDC, it is essential that it
> is right. This checks that vDC is up to date in that each class's
> implementation of vDCInner: and ...FixupWith: handle all instance variables.

Still, if it's a requirement for projects so either remove that
requirement
or check this only when switching project (or otherwise accessing this)
but
not on fileOut and every 10 minutes otherwise.

A comment in the affected classes  plus some code like that strange
warning
when overwriting #new could have been a better approach I think.  But
perhaps
I still doesn't really have understand the problem here.  All I can say
is
that the code smells...

The current way of doing it sounds like a hack for me.  I really
appreciate
your work to make it faster, but still, I think the whole idea is
stupid.


bye
-- 
Stefan Matthias Aust             Projektleiter/Softwareentwicklung
Baltic Online Computer GmbH,    Alter Markt 1-2,        24103 Kiel
Fon: +49 (0) 431-54003-0 Fax: -99      http://www.baltic-online.de





More information about the Squeak-dev mailing list