[REBOL] Re: Words with no value error
From: tim:johnsons-web at: 8-Jan-2004 8:54
* M&F <[the--optimizer--tiscali--it]> [040108 08:26]:
> Hi all,
> I have menaged to read all the over 400 messages from this list sent
> during last month... :P
> I have a question about the " Script Error: xxx has no value" problem.
> I have seen that there's no way to trap such an error, which is not a
> syntax one.
> 'value? does not work, nor does 'error?.
Try this little console session to get a feel for rebol words
Then read my comments at the end.
>> t: attempt[x]
>> y: 2
>> t: attempt[y]
>> value? 'x
>> print 'x
>> print x
** Script Error: x has no value
** Near: print x
Think of a rebol word as a white-space delimited
string. a rebol word may or may not have a value.
But it always has a spelling.
If you've done anything with LISP or scheme, this
is the inspiration for rebol....
Testing for a value requires a single quote
as in value? 'x
as opposed to value? x
Using 'attempt is guaranteed to return a 'none if
the word has not value.
There is a tutorial on rebol evaluation techniques
using my 'fetch function (somewhere) you might
want to dig into that some time.
Tim Johnson <[tim--johnsons-web--com]>