Hi Elan,

are you sure it works the way you think? I'm only asking, because
you get exactly the same output for:

>> probe ancestor

make object! [
do-something: func ["this function will be inherited"][
    func-1 
    func-2
]
]
>> probe descendant

make object! [
do-something: func ["this function will be inherited"][
    func-1 
    func-2
]
]

and I would like it to work.


regards,

Ingo

Those were the words of [EMAIL PROTECTED]:
> Hi guys,
> 
> Sorry, can't remember all the names. Have little time. 
> 
> Someone observed that descendant objects inherit their ancestor object's
> function implementations and variables. This leads to inflated code. The
> following mechanism can be used to avoid inheriting some code. It uses use
> contexts:
> 
> ancestor: make object! [
>   do-something: none
>   use [var-1 var-1 comment {more vars here} func-1 func-2 func-3 ] [
>     var-1: "this is var-1"
>     var-2: "this is var-2"
>     ;- more vars here ...
>     func-1: func ["extremely long function. don't inherit."] [ 
>       print "func-1: tons of code here"
>     ]
>     func-2: func ["also extremely long function. don't inherit."] [ 
>       print "func-2 tons of code here"
>     ]
>     do-something: func ["this function will be inherited"] [
>       func-1
>       func-2
>     ]
>   ]
> ]
> 
> descendant: make ancestor []
> 
> >> descendant/do-something
> func-1: tons of code here
> func-2 tons of code here
> >> probe descendant
> 
> make object! [
>   do-something: func ["this function will be inherited"][
>     func-1
>     func-2
>   ]
> ]
> 
> ;- Elan
> 
> 
> 
Hi Rebols,




regards,

Ingo

--  _     .                                _
ingo@)|_ /|  _| _  <We ARE all ONE   www._|_o _   _ ._ _  
www./_|_) |o(_|(/_  We ARE all FREE> ingo@| |(_|o(_)| (_| 
http://www.2b1.de/Rebol/                     ._|      ._|

Reply via email to