[REBOL] Re: Help me, Obi Reb Kenobi, you're my only hope!
From: rotenca:telvia:it at: 2-Sep-2002 2:36
Hi Ladislav and Gabriele,
> Your IS-REALLY-ERROR? function works for simple code like above, but, AFAIK,
> we cannot handle all possible cases, like e.g.:
>
> is-really-error? [1 first block2] ; == true
>
> (until errors will be "first class").
You are right about first class, but i think the code above gives the correct
result in the actual implementation of Rebol, because, for example, the
execution of the block:
[x: 1 first block2 x: 2]
is interrupted with a real error when the expression "first block2" is
executed, and "x: 2" is never executed:
do [x: 1 first block2 x: 2]
x ; == 1
so this is a real error in the actual Rebol implementation.
I think, indeed, that is not correct to return false with:
is-really-error? [first block2] ;==false
for the same reason. The function should answer to this question:
"the code fires an error when evaluated?"
and [first block2] fires an error when evaluated.
While the expression:
[type? first block2]
does not fires an error when evaluated
I think there is no difference from this point of view between
[first block] -> error
[first block2] -> error
but there is a difference between
[type? first block] -> error
[type? first block2] -> not error
And Try is enough to discern them.
Is-really-error? should be called:
can-some-functions-accept-this-argument-without-an-error?
and the blocks
[first block2]
can be accepted by many functions if not evaluated, but when you do it, before
passing the result to a function, it always fires an error!
BTW, actual implementation fails with
is-really-error? first block2 ;== *** error!
but can be corrected.
---
Ciao
Romano