RE: [REBOL] Re: Objects, references & values Hi Robert, for hashs and syncing:
have you checked that you need hash! permanently valid? for me most of the time i create the hash on the fly when i know i do a task with some searching. setting it up for some hundred elements seems to be not noticable, compared to rest of work. for searching a single item after a click normal find-loop works well enough. for normal storage i stay with a tree-form (series of objects with series with objects..), which can be saved/loaded pretty well. -Volker [EMAIL PROTECTED] wrote: > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of > > Romano Paolo Tenca > > Sent: Tuesday, December 18, 2001 7:41 PM > > To: [EMAIL PROTECTED] > > Subject: [REBOL] Re: Objects, references & values > > > nameref: in obj1 'name > > > > Now 'nameref is a pointer to a word which is linked to the field called "name" > > in the object 'obj1. > > Hi, yeah that's right but how do you search for the value of nameref? With this > you can't use the hash! datatype because you don't have a value hash! can use. > 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 know that's not easy to achieve. Even with C++ and the STL container you have > the same problem. You can either use the pointer address to your value as > hash-key, or you can use the value as hash-key. What to do if a key-value > changes? Well, search it, remove it and add the new key-value. > > The problem to solve is that you have to be sure to keep everything in sync. In > 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 directly > without executing the house-keeping code. > > > Another method: > > x: bind [name] in obj1 'self > > > > Now x is a block which contains as the first item the word 'name linked to the > > object obj1: > > > > x: bind [name] in obj1 'self > > == [name] > > >> get first x > > == "robert4" > > Ok. BTW: I just had an idea. When using 'bind you can't see from the word, to > which it is bound. Howabout having "bind [name] in obj1 'self" return obj1/name? > This would be very logical IMO. > > 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. > > BTW: What happens if those structures are stored? Will Rebol be able to resolve > the linking again? I don't think so... this implies that a datastructure loader > is needed to setup all those references again. Robert > > -- > To unsubscribe from this list, please send an email to > [EMAIL PROTECTED] with "unsubscribe" in the > subject, without the quotes. > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
