[REBOL] Re: objects without overhead
From: g:santilli:tiscalinet:it at: 24-Oct-2000 13:28
Ole Friis wrote:
> So that's what the REBOL semantics apparently define. However, if the
> _implementation_ of REBOL is clever, those two functions will refer to the
> same function until you start modifying one of them. Then REBOL will split
> them into two, and modify one of them.
It can't work this way, because the function code NEEDS to be
copied and modified each time a new object is created; this is
because you need to bind it to the new object, and keep the old
one bound to the old.
> - Why was REBOL designed this way (as I don't see any benefits of doing it
> that way, as I don't see memory overhead as a benefit)
> - _Does_ the REBOL interpreter actually use "copy-on-write", or should we
> used to writing object-oriented REBOL programs in obscure ways to avoid
> memory and speed penalties (the latter because the values in the prototype
> object has to be copied somehow, and this takes time)?
You can simply use delegation. Or you can throw OOP away, and use
a simpler approach. :-)
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/