Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: objects without overhead

From: rsnell:webtrends at: 19-Oct-2000 9:27

Ole, I believe you are thinking the same way I did which is incorrect. The functions are duplicated as evidenced by a response that Elan sent about this very question a few weeks back. Here it is: ------- from [rebol--techscribe--com] ------ Hi Rodney, I believe REBOL makes a new copy of functions for each derived object. Let me introduce the players: A root object o, a function f, and a derived object p:
>> o: make object! [f: func [] [print "a"] ] >> p: make o []
At this point the two objects are look-alikes:
>> probe o
make object! [ f: func [][print "a"] ]
>> probe p
make object! [ f: func [][print "a"] ] Let us replace the string "a" by the string "b" in p's function f
>> change at second get in p 'f 2 "b"
== [] Were we successful?
>> probe p
make object! [ f: func [][print "b"] ] Yes. Was the function f in the parent object o also modified?
>> probe o
make object! [ f: func [][print "a"] ] No! Apparently modifications to the inherited function f in p do not propagate to the f function in the parent object o, ergo the two functions are independent of each other. ------- end ---------- Rodney