Hi Pat,

your code is almost correct, it just omits one special case. See the
following example:

>> type? a: make error! "my error"
== error!
>> u-def? 'a
== true
>> undefined? 'a
== false

Cheers
    L


------------------
From: "pat665"
Sent: Monday, March 04, 2002 10:54 PM
Subject: [REBOL] [subject: error and trial]


Hi rebollers,

I am coming again with a question posted on November the 23th 2001. At the
time, I thought I had understood Ladislav's answer, but the truth is I am
not so sure.

All began while reading Ladislav's contexts.html...

"There are Words that do not have the ability to refer to Rebol values. We
can call them undefined Words. [ ...] This function can be used to find out,
if a Word is undefined: "

 undefined?: func [
        {determines, if a word is undefined}
        word [any-word!]
    ] [
        error? try [error? get/any :word]
    ]

My question was "why use error? two times?". In my eyes, a more simple
version of the function could be :

 u-def?: func [
        {determines, if a word is undefined}
        word [any-word!]
    ] [
        error? try [get/any :word]
    ]

We can test these two functions whith Ladislav's own example of an undefined
word.

    a-word: first first rebol/words ;== end!

 >> undefined? a-word
 == true
 >> u-def? a-word
 == true

 >> undefined? 'print
 == false
 >> u-def? 'print
 == false

I am not pretending I am right, because I must be wrong! but I deeply need
to understand where and why !

Patrick


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to