[REBOL] Re: Business Object Versioning
From: rotenca:telvia:it at: 5-Apr-2002 14:16
> What needs to be done to update an object? Well, there are only four things:
> 1. Add a new variable and value to an object
> 2. Rename a variable in an object
> 3. Delete a variable from an object
> 4. Set a different value for an existing variable in an object
> I really would like to have object manipulation functions for 1, 2 and 3.
> 1 can be solved by short function;-).
> Does anybody has a good idea how to do 2. and 3.?
A rename func:
rename-ob: func [o name1 name2][context head change find third o to-set-word
name1 to-set-word name2]
>> o: context [a: 1 b: 2]
>> probe rename-ob o 'a 'c
make object! [
but there are many many situations in which it fails:
o: context [a: 1 b: [a: 3]]
o: context [a: 1 b: func  [a: 3]]
rename-ob o 'a 'c
change the first a: but not the second one.
The same for delete:
delete-ob: func [o name][context head remove/part find third o to-set-word