[REBOL] Re: Removing members from a context
From: anton::wilddsl::net::au at: 30-May-2007 21:35
The answer is no.
You can't add or remove members from an object.
Once created, the members are fixed.
The only thing you can do is derive a new object
from the old one, specifying only the members you want to keep,
and then copy the values across from the old object. eg.
old: context [a: 1 b: 2 c: 3]
members: exclude first old [self c] ;== [a b]
spec: copy members
forall spec [spec/1: to-set-word spec/1]
append spec none ;== [a: b: none]
new: context spec
foreach word members [set/any in new word get/any in old word]
print mold new ;== make object! [a: 1 b: 2]
In Rebol version 3, the above situation changes a little bit,
and you will be allowed to add members to an existing object.
However, I don't think that you will be able to remove members.