[REBOL] Re: words&context was: (Re: Update)
From: robert:muench:robertmuench at: 4-Jun-2001 11:45
> -----Original Message-----
> From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
> Ladislav Mecir
> Sent: Tuesday, May 29, 2001 5:59 PM
> To: [rebol-list--rebol--com]
> Subject: [REBOL] Re: words&context was: (Re: Update)
> there is no way how to "extend" an existing object currently. You can only
> simulate such behaviour, i.e. write a work-around.
Hi, don't know if it's still a topic for you but here is a "workaround", you are
right that there is no native way to extend an object.
extend-object: func ['obj-word [word!] 'word [word!] value [any-type!] /local
the-obj][
all [not object? the-obj: get obj-word make error! "No object provided."]
if in the-obj word [
set in the-obj word value
return the-obj
]
set obj-word make the-obj reduce [to-set-word word value]
]
use like:
extend-object objectoextend newword newvalue
Robert