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

[REBOL] Re: Embedded Object and Scope yet again...

From: joel:neely:fedex at: 10-May-2001 23:13

Hi, all! Just a small further demonstration that the term "embedded object" is of questionable significance in REBOL...
>> ob11: none
== none (just to make sure that there's nothing up my sleeve...)
>> ob1: make object! [
[ a: 1 [ init: func [n [integer!]] [a: n] [ do [ [ ob11: make object! [ [ b: 10 [ init: func [n [integer!]] [b: n] [ wot: func [] [a + b] [ ] [ ] [ ] So where does that leave us?
>> source ob11
ob11: make object! [ b: 10 init: func [n [integer!]][b: n] wot: func [][a + b] ]
>> source ob1
ob1: make object! [ a: 1 init: func [n [integer!]][a: n] ] But notice what A in OB11/WOT refers to!
>> ob11/wot
== 11
>> ob1/init 3
== 3
>> ob11/wot
== 13
>> ob11/init 20
== 20
>> ob11/wot
== 23 So, is OB11 an "embedded object" in OB1 or not? PRO: It contains a word (A) belonging to the context of OB1. It was created during the creation of OB1. CON: OB1 contains no reference to OB11. OB11 is, in fact, a global name. Maybe the question contains too much baggage in the phrase embedded object , eh wot? -jn-