Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!news.ecn.bgu.edu!vixen.cso.uiuc.edu!uwm.edu!lll-winken.llnl.gov!simtel!news.kei.com!newsfeed.internetmci.com!in1.uu.net!world!carlg
From: carlg@world.std.com (Carl E Gundel)
Subject: Re: Need for a becomeButReturnOriginal: method
Message-ID: <DIG6sL.L3A@world.std.com>
Organization: The World, Public Access Internet, Brookline, MA
X-Newsreader: TIN [version 1.2 PL2]
References: <48ud9p$qed@newsbf02.news.aol.com>
Date: Wed, 22 Nov 1995 13:57:57 GMT
Lines: 24

Dogmat (dogmat@aol.com) wrote:
: I need a become: method that doesn't send the original off to the ozone,
: i.e., with nothing pointing to it. I need to maintain a single pointer to
: the original. This would best be handled by a method perhaps called:

: objectOriginal := objectToBeCopied becomeButReturnOriginal: aNewObject

: where the objectToBeCopied would become aNewObject, but the original would
: be returned to be assigned to objectOriginal.

It seems like what you need could be accomplished by completely copying 
the receiver of #becomeButReturnOriginal: and then returning the copy 
after sending #become: aNewObject.

The versions of the deepCopy method I've seen don't copy all of an 
object's instance variables and their variables recursively.  You may 
have to roll your own method for that.

Carl
-- 
------------------------------------------------------------------
Carl Gundel  carlg@world.std.com  Shoptalk Systems  508-872-5315
author of Liberty BASIC,  "EASY Windows and OS/2 programming!"
http://world.std.com/~carlg/basic.html
