I wrote:
Your example fails because 'a/q2 is a path! not a word!
Which, while true, is not the correct explanation as to why your
example fails
Again, your example:
a: make object! [ q1: 100]
value? 'a/q2
>> ; failed example
>> a: make object! [ q1: 100]
>> value? 'a/q2
== true
>> ; first, comprehend value?
>> source value?
value?: native [
"Returns TRUE if the word has been set."
value
]
Your example fails because value? returns true on the value
'a/q2 being set in the global context of REBOL, not in the
context of any object
A quick check reveals that REBOL will return true for value?
query on any ticked phrase you give it. Why? because each tick
phrase typed at the console is a value in the global context!,
e.g.,
>> value? 'z/y/x/w/v/u
== true
>> value? 'another/typed/value/in/the/global/context/of/REBOL
== true
>> ; REBOL truth
>> word? 'a/q2
== false
>> path? 'a/q2
== true
The rest of my explanation holds:
The definitional of any object is just a block. Think of the
outer [] as "invisible".
>> probe a
make object! [
q1: 100
]
>> first a
== [self q1]
>> type? first a
== block!
>> second a
== [make object! [
q1: 100
] 100]
>> type? second a
== block!
Let's use 'a as a prototype for 'b
>> b: make a [
[ q2: "some aspect"
[ ]
>> probe b
make object! [
q1: 100
q2: "another aspect"
]
Let's define debate (my word for func) to discover the aspects
of any object
aspects: debate [
internals [object!]
][
probe next first internals
]
>> aspects: debate [
[ internals [object!]
[ ][
[ probe next first internals
[ ]
>> aspects b
[q1 q2]
== [q1 q2]
>> type? aspects b
[q1 q2]
== block!
now, we can 'find on the aspects of any object
>> find aspects a 'q1
[q1]
== [q1]
>> find aspects a 'q2
[q1]
== none
>> find aspects b 'q2
[q1 q2]
== [q2]
You could parse if you had expectation of an existing layout of
object words (internals), e.g.,
If you expect your object to look like
b: context [
q1: 100
q2: "some aspect"
]
then you can use parse, e.g.,
>> internals: ['q1 'q2]
== ['q1 'q2]
>> parse aspects b internals
[q1 q2]
== true
>> new-internals: ['q1 'q2 'q3]
== ['q1 'q2 'q3]
>> parse aspects b new-internals
[q1 q2]
== false
Here are two great works that can help you comprehend what's
going on inside REBOL:
http://www.fm.vslib.cz/~ladislav/rebol/contexts.html
http://www.pat665.free.fr/doc/bind.html
Also, you can check out my work, which is alternative way of
looking at REBOL (non-computer science, non-High Priests of
Academia way) at http://rebolese.blogspot.com
Pier Johnson
Thousand Oaks, CA, USA
________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.