Object Swapping?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Object Swapping?

matt bellue
Hi,
We are a small group in Fontana learning Squeak together.  We are curious, is there an object swapping function, like LOOM, built into squeak?

Thanks,
Matt


How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.

Reply | Threaded
Open this post in threaded view
|

Re: Object Swapping?

Tom Phoenix
On 8/11/06, matt bellue <[hidden email]> wrote:

> is there an object swapping function, like LOOM, built into squeak?

Do you mean some kind of virtual-memory ability to keep part of a
large object on disk? Or are you trying to do something completely
different?

--Tom Phoenix

Reply | Threaded
Open this post in threaded view
|

Re: Object Swapping?

Lukas Renggli
In reply to this post by matt bellue
>  We are a small group in Fontana learning Squeak together.  We are curious,
> is there an object swapping function, like LOOM, built into squeak?

#become:

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: Object Swapping?

Michael van der Gulik
Lukas Renggli wrote:
>>  We are a small group in Fontana learning Squeak together.  We are
>> curious,
>> is there an object swapping function, like LOOM, built into squeak?
>
>
> #become:

Ah... if that's the right answer, there are some caveats:

1. become: will switch object pointers. becomeForward will make the two
objects the same as the argument to becomeForward.

2. It's (as far as I know) a slow method. Squeak has direct object
pointers rather than an object lookup table.

3. Be careful with dictionaries. If you swap object pointers, hashes
(especially identityHash) will change, which does bad things to
dictionaries. See also becomeForward:copyHash:. Be especially careful
with anything that's stored in the SystemDictionary.

4. Don't save your image after you test your code. Write your code, save
the image (and maybe your code using Monticello to local disk), run your
code, and then quit squeak and restart. Otherwise you may end up with a
corrupted image. I have been through a few. Also, keep periodic backups
of your progress in another directory or something.

Michael.