[REBOL] Re: Adding functions to an object.
From: rotenca:telvia:it at: 26-Feb-2002 17:21
> This is a question only for people who have
> finished their bindology degrees.
> I thought of using make, with the object as a template, but
> that makes a new object. I want to modify the existing
> object in place. Is that possible?
No. Only the global context can be extended. But you could make:
1) something like your library file:
>> x: "context [f1: func [x][x]]"
== "context [f1: func [x][x]]"
2) something like your 'include func (without the library file name):
>> include: func [arg][lib: do x set arg/1 get in lib arg/1]
3) now use it:
>> o: context [f1: none include [f1]]
4) the result:
>> probe o
make object! [
f1: func [x][x]
The body of the included function remain bind to the original context.