[REBOL] Re: Objects, references & values
From: rotenca:telvia:it at: 20-Dec-2001 14:26
Hi, Robert
> Hi, :-)) as non native english speaker it's not so easy to describe a
problem
> that detailed, that the others can follow...
I can't speak well of my english, but yours seem good to me.
> > >> ob: context [name: "romano"]
> > >> h: append append make hash! [] get in ob 'name in ob 'name
> > == make hash! ["romano" name]
> > >> change ob/name "dolores"
> > == ""
> > >> h
> > == make hash! ["dolores" name]
>
> Hmm... what happens if we have several names here? Would this result in:
>
> ["dolores" name "romano" name ...]
>
> Why the 'name entry? With such a hash! I could search for a name value and
get a
> 'name word that is linked to the address object, right?
yes.
So you could retrieve the object with a:
probe get bind 'self select h "dolores" ; if you are sure that self is well
defined in the object and "dolores" in the hash
> Would it be possible to
> use 'self instead of 'name? I used numbers as object index because these
don't
> change if reduced twice.
yes
>> h: append append make hash! [] get in ob 'name in ob 'self
== make hash! ["romano" self]
but if you prefer, you could put a direct pointer to the object:
>> h: append append make hash! [] get in ob 'name get in ob 'self
== make hash! ["romano"
make object! [
name: "romano"
]]
---
Ciao
Romano