I've read internally R2 stores contexts as two tables, one for words and the other for values, so you can ask for them:
o: context [a: 1 b: 2]
>> first o
== [self a b]
>> second o
== [make object! [
a: 1
b: 2
] 1 2]
in any way...
>> pick o 1
== [self a b]
>> pick o 2
== [make object! [
a: 1
b: 2
] 1 2]
but there's a third "table" (a block) which seems to be undocumented and this one is only accessible using third function
>> third o
== [a: 1 b: 2]
>> pick o 3
** Script Error: Out of range or past end
** Near: pick o 3
what is supposed to be this third block?
something similar seem to occur in functions but this time both third and pick perform well:
>> f: func [a] [print a]
>> first :f
== [a]
>> second :f
== [print a]
>> third :f
== [a]
>> pick :f 1
== [a]
>> pick :f 2
== [print a]
>> pick :f 3
== [a]
first block is params, second block is body but what does this third block represents in a function?
Third
returns object definition.
>> body: [a: 1 b: 2]
== [a: 1 b: 2]
>> obj: context body
>> equal? body third obj
== true
>> strict-equal? body third obj
== true
It's same as body-of
in Rebol 2.7.7 and higher and Rebol 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With