Hi Luke,

L> I dont understand Gregg what you mean when you say
L> the context of an object isnt dynamic. It probably goes 
L> beyond my current level of understanding of how REBOL 
L> works.

It just means that once you create an object, you can't add or remove
words from its context (words bound to the object); it's a fixed size.
You have to create a new object, which then has its own fixed size
context to add or remove words.

L> But if so, then how does that explain why can I do this 
L> (but not reverse the action):

L> ;---create object
L> obj: make object [a: 1]

L> ;---add a new word to the object
L> obj: make obj [b: 2]

This works because you're making a new object. After it's made, all
you can do is change the values that its words refer to, you can't
unbind and remove the words themselves. To do that, you need to create
a new object that just doesn't contain them.

L> object-remove-word: func [object word /local ...

Does this work for you?

remove-word: func [object word] [
    make object! head remove/part find third object to set-word! word 2
]

It's dense code, I know. Here's how the calls relate:

make object!
  head
    remove/part
      find
        third object
        to set-word! word
      2

It will fail with an error if the word doesn't exist in the object.
Just FYI.

-- Gregg                         

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to