[REBOL] Re: Embedded objects.
From: sunandadh:aol at: 13-Mar-2003 4:44
> > Sunanda has the solution, but thinking there must be a more graceful
> > approach? Perhaps not.
> Hmmmm... But Sunanda's explicit proviso points out a severe
> limitation of this approach
I'm with Joel on this. Unless you are absolutely certain that an object won't
be referenced in more than one place, then techniques that replace it with
another identically named object are dicey.
Take this example. Bob is a person so we save him in the People block. Later
(after we've replaced Bob with the new Bob) we check what's in the People
block. It's the old Bob! Look: no dog!! Hey, we could make that into a stage
BobsDog: make object! [name: "Rex"]
Bob: make object! [name: "Bob"]
people: copy 
append people Bob
probe people/1 ;; check it's Bob alone in there
Bob: make Bob reduce [to-set-word 'BobsDog BobsDog]
probe bob ;; show Bob has a dog
probe people/1 ;; Bob without a dog!
append People Bob ;; now there's two Bobs in the block
sort People ;; etc -- play around with the block and see how confusing it
The two techniques better than mine suggested so far are:
1. Joel's that you plan ahead and have a block in the Object that takes all
2. Andrew's that you use a block instead of an object.