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


Groups > comp.lang.forth > #12599

Re: More on Boolean Shortcircuiting

From Arnold Doray <invalid@invalid.com>
Newsgroups comp.lang.forth
Subject Re: More on Boolean Shortcircuiting
Date 2012-05-30 13:52 +0000
Organization A noiseless patient Spider
Message-ID <jq58ml$25h$1@dont-email.me> (permalink)
References (5 earlier) <dadc1d97-9e12-4712-a432-6c7922e08754@b1g2000vbb.googlegroups.com> <jq47j5$bb4$1@dont-email.me> <eeb8e07a-9c00-4e87-a41c-37ab3a25f551@8g2000vbu.googlegroups.com> <jq4v1e$p2s$1@dont-email.me> <wZKdnQwKfNEJlVvSnZ2dnUVZ_rCdnZ2d@supernews.com>

Show all headers | View raw


On Wed, 30 May 2012 06:46:28 -0500, Andrew Haley wrote:

>> Understood. But it looks pretty brittle to me, especially if multiple
>> exceptions could be thrown or at a much higher upstream the calling
>> hierarchy. For example, if there were say five THROWS upstream you'd be
>> hard pressed trying to clean up the mess at CATCH,
>> even with your stack diagrams.
> 
> This doesn't make sense.  The stack is restored to whatever depth is was
> at CATCH.
> 
>> Ditto for an exception thrown in another module in some private word.
> 
> Exceptions are part of a word's API: any caller must know what they
> throw.  You have to catch the exceptions.

What I am having trouble understanding is the necessity to put junk on 
the stack once it is consumed below the levels prior to CATCH being 
issued. This junk invariably has to be cleared for the program to 
proceed, so why bother putting it in the first place? 

Alex McDonald has given a simple mechanism for junk-clearing by looking 
at the stack comments, but it doesn't work well for a THROW issued right 
up the hierarchy ( too much to track ) or if there are multiple THROWS 
that could be thrown ( multiple failure modes ). And if there really is a 
need to put in junk, why not consistently put in 0s? That at least makes 
for consistent behaviour, simplifying debugging. But all this is besides 
the point. Why have junk at all? What's so special about stack depth that 
it needs to be preserved??? 

Stack clearing on THROW is certainly very useful in one narrow context -- 
when the stack before pre-CATCH is never disturbed, but that seems 
unrealistic in the vast majority of scenarious where THROW...CATCH is 
useful. 

What might be useful is saving a copy of the data & return stacks and 
restoring them on error. But that's a lot of overhead of course and 
entirely unpracticable in constrained environments. Which is why my 
intuition says that the sensible thing is to do nothing, and accept that 
cleanup has to be done manually. 

Cheers,
Arnold










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


Thread

More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-26 09:39 +0000
  Re: More on Boolean Shortcircuiting Josh Grams <josh@qualdan.com> - 2012-05-26 12:44 +0000
    Re: More on Boolean Shortcircuiting Josh Grams <josh@qualdan.com> - 2012-05-26 12:47 +0000
      Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-26 14:16 +0000
    Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-26 13:48 +0000
      Re: More on Boolean Shortcircuiting Josh Grams <josh@qualdan.com> - 2012-05-27 00:17 +0000
  Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-26 08:27 -0700
    Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-26 10:25 -0700
      Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-27 10:47 +0000
        Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-27 07:00 -0700
          Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-27 17:20 +0000
            Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-27 15:03 -0700
  Re: More on Boolean Shortcircuiting "David N. Williams" <williams@umich.edu> - 2012-05-26 17:17 -0400
    Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-26 14:49 -0700
    Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-27 10:21 +0000
  Re: More on Boolean Shortcircuiting Josh Grams <josh@qualdan.com> - 2012-05-28 14:24 +0000
    Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-28 10:27 -0700
      Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-29 09:18 +0000
    Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-28 12:41 -0500
      Re: More on Boolean Shortcircuiting "Elizabeth D. Rather" <erather@forth.com> - 2012-05-28 07:55 -1000
    Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-29 11:34 +0000
    Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-29 13:53 +0000
      Re: More on Boolean Shortcircuiting Alex McDonald <blog@rivadpm.com> - 2012-05-29 07:02 -0700
        Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-30 01:45 +0000
          Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-29 20:02 -0700
            Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-30 04:27 +0000
              Re: More on Boolean Shortcircuiting Alex McDonald <blog@rivadpm.com> - 2012-05-30 02:09 -0700
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-30 11:07 +0000
                Re: More on Boolean Shortcircuiting Alex McDonald <blog@rivadpm.com> - 2012-05-30 04:38 -0700
                Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-30 06:46 -0500
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-30 13:52 +0000
                Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-30 09:02 -0500
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-30 14:13 +0000
                Re: More on Boolean Shortcircuiting Alex McDonald <blog@rivadpm.com> - 2012-05-30 07:41 -0700
                Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-30 11:46 -0500
                Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-31 09:18 -0700
                Re: More on Boolean Shortcircuiting Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-31 11:54 +0000
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-31 15:17 +0000
                Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-31 11:17 -0500
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-31 17:40 +0000
                Re: More on Boolean Shortcircuiting "Elizabeth D. Rather" <erather@forth.com> - 2012-05-31 08:43 -1000
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-06-01 02:56 +0000
                Re: More on Boolean Shortcircuiting anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-01 09:49 +0000
                Re: More on Boolean Shortcircuiting "Elizabeth D. Rather" <erather@forth.com> - 2012-06-01 09:18 -1000
                Re: More on Boolean Shortcircuiting Josh Grams <josh@qualdan.com> - 2012-05-31 16:45 +0000
                Re: More on Boolean Shortcircuiting BruceMcF <agila61@netscape.net> - 2012-05-31 09:58 -0700
                Re: More on Boolean Shortcircuiting Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-31 18:38 +0000
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-06-01 03:09 +0000
                Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-01 02:44 -0500
                Re: More on Boolean Shortcircuiting Mark Wills <markrobertwills@yahoo.co.uk> - 2012-06-01 04:57 -0700
                Re: More on Boolean Shortcircuiting anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-01 12:45 +0000
                Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-01 08:45 -0500
                Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-06-01 15:18 +0000
              Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-30 06:39 -0500
      Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-29 09:52 -0500
        Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-30 01:48 +0000
          Re: More on Boolean Shortcircuiting Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-05-30 07:55 +0100
          Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-30 02:56 -0500
            Re: More on Boolean Shortcircuiting Arnold Doray <invalid@invalid.com> - 2012-05-30 11:31 +0000
              Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-30 06:53 -0500
                Re: More on Boolean Shortcircuiting Alex McDonald <blog@rivadpm.com> - 2012-05-30 05:04 -0700
                Re: More on Boolean Shortcircuiting Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-30 09:03 -0500
      Re: More on Boolean Shortcircuiting Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-05-29 17:49 +0100
        Re: More on Boolean Shortcircuiting Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-05-29 19:06 +0100
      Re: More on Boolean Shortcircuiting Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-29 20:25 +0000

csiph-web