[REBOL] Re: Objects, references & values
From: rotenca:telvia:it at: 19-Dec-2001 15:28
> > nameref: in obj1 'name
> > Now 'nameref is a pointer to a word which is linked to the field called
> > in the object 'obj1.
> Hi, yeah that's right but how do you search for the value of nameref? With
> you can't use the hash! datatype because you don't have a value hash! can
> That's why I would like to have a value which I can add to a hash! that's
> updated when the referenced value changes.
I do not understand what you want to say. I can add it to a hash! datatype:
>> x: context [a: 2]
>> nameref: in x 'a
>> append make hash! 1 nameref
== make hash! [a]
the value of 'a in the hash datatypes changes with the value of a in the x
> The problem to solve is that you have to be sure to keep everything in sync.
> C++ you can do this by using member-functions and makeing the data-members
> private to the object. This ensures that none will be accessed/changed
> without executing the house-keeping code.
Also in rebol you can make private field (with some tricks). Also in rebol you
can make member-functions.
Sorry, I continue to not understand what you want to say.
> Ok. BTW: I just had an idea. When using 'bind you can't see from the word,
> which it is bound. Howabout having "bind [name] in obj1 'self" return
> This would be very logical IMO.
And just this happens if 'self is well defined in the obj1.
> As said, the biggest problem I currently have is that I would like to have a
> simple way to use the well known datastructures for managing objects, values
> etc. and being able to search, store etc. those datastructures.
I do not understand what do you want to do, that cannot be made. I don't see
it, a part store, see below.
> BTW: What happens if those structures are stored? Will Rebol be able to
> the linking again? I don't think so... this implies that a datastructure
> is needed to setup all those references again.
This is true. But load/save are for loading code and related data struct not
for snapshot of data. This seems to me a relational database work.