Object pointers
Doug Way
dway at riskmetrics.com
Sat Mar 23 05:22:44 UTC 2002
Chris Becker wrote:
>
> Is there a way to store an object's *pointer* in a variable? Something akin
> to this:
>
> var := 'an object'.
> pvar := var pointer.
>
> pvar := 'new value'.
>
> var ==> 'new value'
>
> Is there any way to achieve this?
Pointers aren't really that useful in a high-level language. (They can
be useful in C, but C is not a high-level language.)
But you can do something similar with #become:... well, maybe it's not
that similar. :) Try this:
var := 'an object'.
pvar := var.
pvar become: 'new value'.
var ==> 'new value'
- Doug Way
dway at riskmetrics.com
More information about the Squeak-dev
mailing list
|