[REBOL] Re: DyBASE test
From: SunandaDH:aol at: 27-Dec-2003 17:18
Konstantin:
> And once object
> is created it is not possible to add fields to it (very strange
> restriction for such flexible and dynamic language as Rebol).
In simple cases (if the object is not yet referenced anywhere else), it is
very simple....
an-object: make object! [field1: now]
an-object: make an-object [field2: true] ;; "adds a field"
Problems may arise if the original an-object is referenced elsewhere:
a-block: copy []
an-object: make object! [field1: now]
append a-block an-object
an-object: make an-object [field2: true]
append a-block an-object
probe a-block/1 ;; not the same as
probe a-block/2 ;; this
See also
http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=extend-an-obje
ct.r
and its documentation -- it may be doing what you need (though it doesn't
solve the existing-references problem)
Sunanda.<