Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Is this wor...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 9 Topic 3829 of 4288
Post > Topic >>

Re: Is this workable? .warning .error

by Bruce McFarling <agila61@[EMAIL PROTECTED] > Mar 12, 2008 at 10:22 AM

On Mar 12, 12:40 pm, m_l...@[EMAIL PROTECTED]
 wrote:
> 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

Thanks, that's an example of why use a resettable wrapper word Nicl
defines.

OK, I'll change it to:

VARIABLE Nicl-errorcode

: Nicl-err ( throw# ca u -- )
    {.Nicl-warn} EXECUTE DUP Nicl-errcode ! ?DUP IF
        {Nicl-err} EXECUTE
    THEN
;

> Maybe, something like
> : myerror ?DUP IF . ABORT THEN ;
> ?
>
> By the way, ABORT" xyz" ( x -- ) checks for x being 0.

I know ... but I want it to be non-parsing, and I don't want to need
THROW" lying around.
 




 9 Posts in Topic:
Is this workable? .warning .error
Bruce McFarling <agila  2008-03-10 16:25:51 
Re: Is this workable? .warning .error
m_l_g3@[EMAIL PROTECTED]   2008-03-12 09:40:57 
Re: Is this workable? .warning .error
Albert van der Horst <  2008-03-12 22:43:07 
Re: Is this workable? .warning .error
Bruce McFarling <agila  2008-03-12 10:22:02 
Re: Is this workable? .warning .error
m_l_g3@[EMAIL PROTECTED]   2008-03-12 10:52:47 
Re: Is this workable? .warning .error
Bruce McFarling <agila  2008-03-12 16:45:27 
Re: Is this workable? .warning .error
Albert van der Horst <  2008-03-13 10:30:31 
Re: Is this workable? .warning .error
Bruce McFarling <agila  2008-03-12 19:34:48 
Re: Is this workable? .warning .error
Bruce McFarling <agila  2008-03-13 05:40:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 8:21:47 CDT 2008.