[REBOL] Re: Ready for REBOL/Core 2.6?
From: pwoodward:cncdsl at: 8-Mar-2002 13:52
Gregg
> The issue, as I understand it, is that you can't add new functions and
> variables to TIMER. It's set of words is fixed when it is created and
cannot
> be extended. You would have to create a new object, based on TIMER, in
order
> to add new words to it.
Yeah, I realized that - but it's not so different that the static
inheritance found in other OO languages. Unless I was to use "timer: make
example [newvar: 1000]" when I cloned the object, I can't add new variables
or functions to it.
What would be handy is if append and other block/series related functions
could work against objects. Sure, having an "extend" macro that perhaps
automated the appending of new variables and functions (or even the
overriding and extension of extisting ones) would definitely be handy in
that case.
Currently the Rebol object doesn't loose much over other, existing, object
models. If we think of our object declarations as "classes" and treat them
as somewhat static blue-prints then they behave almost exactly as a "class"
in another language. You can build a fairly complex heirarchy that way.
Then, when you use them, think of using it like - "someobject: make myclass
[]" as though you are calling "new" against the class, and creating an
instance of it.
But - what "extend" would get us is the ability to dynamically alter
existing objects from their blue prints, after they have been created. It'd
be cool, but I'm not sure it'd be of much value. If you were finding
yourself doing that a lot I suspect you may be better off just adding that
function or variable to the prototype object.
- Porter Woodward