[REBOL] Re: objects without overhead
From: ole_f:post3:tele:dk at: 18-Oct-2000 20:58
Hi , 17-Oct-2000 you wrote:
>The thing I don't like about this solution is that every instance of
>this object has duplicate copies of the functions
Just define a "parent" object containing all of your functions, then create
your "used" objects by cloning this object. The "used" objects then won't
include the functions, but as the "parent" object is the prototype for the
objects, then you can still use your functions through these objects.
Example (not tested):
parent: make object! [
func1: func [a] [print a]
func2: func [a b] [print [a b]]
child1: make parent [
var1: "This is a variable in a child object"
c-func1: func [a] [func1 join a var1]
child2: make parent [
var2: "This is another variable in another child object"
c-func2: func [a b] [func2 var2 join a b]
Well, I guess you get the idea.