I made some tests. I found the document about binding very light and useful=
!

I solved the problem in tw ways:

a: make object! [
   q1: "Here I am"
]

USING "IN":

>> in a 'q1
=3D=3D q1
>> in a 'q2
=3D=3D none
>>

USING "FIND":

>> find first a 'q1
=3D=3D [q1]
>> find first a 'q2
=3D=3D none
>>

I will use the first method, since it is used to check if a word is
defined in a specific context:

>> ? in
USAGE:
    IN object word

DESCRIPTION:
     Returns the word in the object's context.
     IN is a native value.

ARGUMENTS:
     object -- (Type: object port)
     word -- (Type: any-word)
>>

So, my code will be:

either (in a 'q1) <> none [
     ; q1 exists: do domething
] [
     ; q1 does NOT exists, then do something else!
];either


Thank you for your help!









On 5/7/06, Alessandro Manotti <[EMAIL PROTECTED]> wrote:
> Ok, thank you!
> I will read something more about bind and context.
>
> I saved your short tutorial in my PC just for reference for the future!  =
 :-)
>
> (I will include these controls in my Jell Project).
>
> --Alessandro
>
>
>
>
> On 5/7/06, Pierre Johnson <[EMAIL PROTECTED]> wrote:
> >
> > 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
> > =3D=3D 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
> > =3D=3D true
> >
> > >> value? 'another/typed/value/in/the/global/context/of/REBOL
> > =3D=3D true
> >
> > >> ; REBOL truth
> > >> word? 'a/q2
> > =3D=3D false
> >
> > >> path? 'a/q2
> > =3D=3D 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
> > =3D=3D [self q1]
> > >> type? first a
> > =3D=3D block!
> >
> > >> second a
> > =3D=3D [make object! [
> >         q1: 100
> >     ] 100]
> > >> type? second a
> > =3D=3D 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]
> > =3D=3D [q1 q2]
> > >> type? aspects b
> > [q1 q2]
> > =3D=3D block!
> >
> > now, we can 'find on the aspects of any object
> >
> > >> find aspects a 'q1
> > [q1]
> > =3D=3D [q1]
> > >> find aspects a 'q2
> > [q1]
> > =3D=3D none
> > >> find aspects b 'q2
> > [q1 q2]
> > =3D=3D [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]
> > =3D=3D ['q1 'q2]
> > >> parse aspects b internals
> > [q1 q2]
> > =3D=3D true
> >
> > >> new-internals: ['q1 'q2 'q3]
> > =3D=3D ['q1 'q2 'q3]
> > >> parse aspects b new-internals
> > [q1 q2]
> > =3D=3D 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.
> >
> >
>
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to