On Mar 11, 2:25 am, Bruce McFarling <agil...@[EMAIL PROTECTED]
> wrote:
[...]
> \ .warning prints a cautionary warning ... you will want to use
> something
> \ more elaborate than TYPE for full screen applications
> [UNDEFINED] .warning [IF]
> ' TYPE VALUE {.warning}
> : .warning ( ca u -- ) {.warning} EXECUTE
> [THEN]
>
> \ .error prints a cautionary warning, then returns as an exception
> \ If you use CATCH/THROW, you will wish to use THROW for {error}
> [UNDEFINED] .error [IF]
> ' ABORT VALUE {error}
> : .error ( throw# ca u -- ) {.warning} EXECUTE {error} EXECUTE
> [THEN]
>
> For a long while, I was hung up on the fact that THROW required the
> throw code and ABORT did not, until it occurred to me that ... yeah,
> obviously, but then I never said programming was my field ... what
> harm is an extra parameter on the stack if you are calling ABORT?
>
> "At worst" ABORT will be throwing away the throw code, and at best the
> stack state will be displayed or available on ABORT, so that the throw
> code gives useful information in any event.
0 THROW is equivalent to 0 DROP
while 0 ABORT is equivalent to ABORT
Maybe, something like
: myerror ?DUP IF . ABORT THEN ;
?
By the way, ABORT" xyz" ( x -- ) checks for x being 0.


|