[REBOL] Re: Error trapping (Was: Beginner's questions on REBOL/Core and REBOL/Vi
From: lmecir:mbox:vol:cz at: 12-Sep-2002 11:54
Hi Anton,
I almost did, see the DEFAULT2 function I posted some time ago :-). But,
seriously:
1) we are unable to handle crashes
2) we are unable to catch some errors (especially throw-errors)
3) do/next cannot handle cases like:
do/next [
do [
lots-of-code-here
]
]
with sufficient granularity.
4) it would really be better to traverse the interpreter stack:
a: func [x] [1 / x] a 0
** Math Error: Attempt to divide by zero
** Where: a
** Near: 1 / x
I would prefer the message to be:
** Math Error: Attempt to divide by zero
** Near: 1 / x
** Where: a 0
Another (more complicated) example:
a: func [f x] [f x] a func [x] [1 / x] 0
** Math Error: Attempt to divide by zero
** Where: f
** Near: 1 / x
Similarly as above, the two-level message I prefer would be:
** Math Error: Attempt to divide by zero
** Near: 1 / x
** Where: f x
, but a three-level message:
** Math Error: Attempt to divide by zero
** Near: 1 / x
** Where: f x
** Where: a func [x] [1 / x] 0
would be more helpful in this case.
Cheers
-L
----- Original Message -----
From: "Anton"
We could probably make our own "line by line",
or expression-by-expression interpreter.
Check out do/next.
Anton.