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


Groups > comp.lang.forth > #24716

Re: How to abort loops and other return stack fiddling words…

Newsgroups comp.lang.forth
Date 2013-07-22 20:25 -0700
References <87bo5ugbsq.fsf@pestilenz.org> <b161d7ea-6e05-4b66-bf53-b3f8542f2288@googlegroups.com> <ksj9pq$oll$1@dont-email.me>
Message-ID <7e7bc73f-e82c-40af-a4ae-8cbc93151543@googlegroups.com> (permalink)
Subject Re: How to abort loops and other return stack fiddling words…
From hughaguilar96@yahoo.com

Show all headers | View raw


On Monday, July 22, 2013 5:56:13 AM UTC-7, Gerry wrote:
> On 22/07/2013 12:18, Mark Wills wrote:
> 
> > a) you can't. At least, not without carnal knowledge of your system. It's an infinate loop, by design, so if you find you need to jump out of it, it means you shouldn't be using it ;-)
> 
> Of course you can exit a BEGIN ... AGAIN loop. Possibilities are:

> 2. Put the loop inside its own colon definition and use EXIT e.g
>     : foo ... begin ... if exit then ... again ;

This is my standard technique; I do this all the time. 
The OP is a novice --- this is an easy technique that works for most cases, so this is what he should use first.

THROW and CATCH is way over-complicated; I only use that for escaping from recursive-descent searches, when I don't know how deep into the recursion I will be when I am ready to escape --- there is no point in doing this outside of the context of recursion.

Manipulating the control-stack only works at one level deep, so it is not very robust. This is a hugely error-prone technique --- I don't recommend it.

Another way to do this, with with multiple WHILE statements in the loop, and multiple THEN statements after the loop. I find this to be very confusing --- I've never done this in practice, although this is the technique that ANS-Forth provided.

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


Thread

How to abort loops and other return stack fiddling words… Christian Kellermann <ckeen@pestilenz.org> - 2013-07-22 11:54 +0200
  Re: How to abort loops and other return stack fiddling words… Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-22 04:18 -0700
    Re: How to abort loops and other return stack fiddling words… Christian Kellermann <ckeen@pestilenz.org> - 2013-07-22 14:31 +0200
      Re: How to abort loops and other return stack fiddling words… daveyrotten <danw8804@gmail.com> - 2013-07-22 08:31 -0700
    Re: How to abort loops and other return stack fiddling words… Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-22 13:56 +0100
      Re: How to abort loops and other return stack fiddling words… Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-22 06:46 -0700
        Re: Re: How to abort loops and other return stack fiddling words… anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 16:01 +0000
          Re: How to abort loops and other return stack fiddling words… rickman <gnuarm@gmail.com> - 2013-07-22 12:31 -0400
            Re: Re: How to abort loops and other return stack fiddling words… anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 16:36 +0000
            Re: How to abort loops and other return stack fiddling words… "Ed" <invalid@invalid.com> - 2013-07-24 12:18 +1000
            Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-24 02:48 -0500
              Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-27 22:15 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-28 03:37 -0500
                Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-29 11:01 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 11:07 -0500
                Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-29 12:32 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 11:54 -0500
                Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-29 13:19 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 15:27 -0500
                Re: How to abort loops and other return stack fiddling words? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-28 03:20 -0700
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-28 08:17 -0500
        Re: How to abort loops and other return stack fiddling words… Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-22 18:07 +0100
      Re: Re: How to abort loops and other return stack fiddling words… albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-22 14:12 +0000
        Re: How to abort loops and other return stack fiddling words… Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-22 17:49 +0100
      Re: How to abort loops and other return stack fiddling words… hughaguilar96@yahoo.com - 2013-07-22 20:25 -0700
  Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-22 07:54 -0500

csiph-web