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

[REBOL] [subject: error and trial]

From: rebol665:ifrance at: 4-Mar-2002 22:54

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 PS: this message has been posted twice because I realized that I did not use the right "from" (the one who is listed) for the first one. You should receive this one first if I am not wrong (again).