Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #57875

Re: ABORT" alternatives

From "HAA" <someone@microsoft.com>
Newsgroups comp.lang.forth
Subject Re: ABORT" alternatives
Date 2017-04-23 11:52 +1000
Organization Aioe.org NNTP Server
Message-ID <odh1ej$1eaa$1@gioia.aioe.org> (permalink)
References <dfb025c1-98d6-4de6-82f5-e0c3ca840b3a@googlegroups.com> <82280e96-af95-4f77-900b-174920bed306@googlegroups.com> <d4dc1dec-c9a9-4c2f-93e7-148c932bb47f@googlegroups.com>

Show all headers | View raw


Julian Fondren wrote:
> On Saturday, April 22, 2017 at 3:59:31 AM UTC-5, Mark Wills wrote:>
> > Maybe just factor it a bit more rather than reaching for the guru code
> > (untested):
> >
> > : badIndex? ( flag n -- ) swap not if . ." *** array index " . ." out of bounds ***"
> > : abort else drop then ; check1 ( x1 dim1 -- x1 )  over u> 1 badIndex? ;
> > : check2 ( x2 dim2 -- x2 )  over u> 2 badIndex? ;
> > : check3 ( x3 dim3 -- x3 )  over u> 3 badIndex? ;
> > : check4 ( x4 dim4 -- x4 )  over u> 4 badIndex? ;
> > : check5 ( x5 dim4 -- x5 )  over u> 5 badIndex? ;
> > : check6 ( x6 dim4 -- x6 )  over u> 6 badIndex? ;
> >
> > KISS (respectfully) :-)
>
> When ABORT" is implemented with THROW , it stops being the same thing
> as IF ." ABORT THEN
>
>   : x abort" you don't see this" ;
>   : y if ." you do see this" abort then ;
>
>   true ' x catch drop  ok
>   true ' y catch drop you do see this ok

Usually ABORT" represents a fatal event that you want to display and abort.

SwiftForth has ?ABORT

: z s" nor will you see this" ?abort ;  ok

true ' z catch drop  ok

To use Mark's factoring you'll need to assemble the target string.


Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

ABORT" alternatives Julian Fondren <julian.fondren@gmail.com> - 2017-04-22 01:28 -0700
  Re: ABORT" alternatives Mark Wills <markwills1970@gmail.com> - 2017-04-22 01:59 -0700
    Re: ABORT" alternatives Julian Fondren <julian.fondren@gmail.com> - 2017-04-22 02:33 -0700
      Re: ABORT" alternatives "HAA" <someone@microsoft.com> - 2017-04-23 11:52 +1000
  Re: ABORT" alternatives anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-24 16:16 +0000

csiph-web