Proposal: Specify that 0 THROW pops the 0

Formal

This page is dedicated to discussing this specific proposal

ContributeContributions

AntonErtlavatar of AntonErtl Specify that 0 THROW pops the 0Proposal2021-09-11 12:25:15

Hint: Please delete the blockquote explanations, they are just for your convenience while writing the proposal

Author:

M. Anton Ertl

Change Log:

First version

Problem:

The specification of THROW does not say that it pops the 0 on 0 THROW

Solution:

The following is a minimal fix. If somebody is willing to give THROW a more substantial rework, go ahead

Typical use: (Optional)

... search-wordlist 0= -13 and throw execute

Proposal:

Behind the stack effect of 9.6.1.2275 THROW, insert

Remove n from the stack.

AntonErtlavatar of AntonErtlNew Version

Show differences

Author:

M. Anton Ertl

Change Log:

This version proposes a less minimal change, resulting after discussions at the 2022i meeting

Problem:

The specification of THROW does not say what happens on 0 THROW

Solution

This is still a pretty minimal change. A more subtantial rework would move the input stream handling elsewhere in the standard (this has come up as a cause for confusion). Moreover, I think the organization of the various cases is suboptimal. A better approach might be

  • n=0
  • n!=0
    • exception stack non-empty
    • exception stack empty
      • n=-1
      • n=-2
      • otherwise

If you want (or don't want) such changes, reply to this proposal.

Typical use: (Optional)

... search-wordlist 0= -13 and throw execute

Proposal:

Behind the stack effect of 9.6.1.2275 THROW, insert

If all bits of n are zero, remove n from the stack and continue execution behind the THROW.

Formal

ruvavatar of ruv

If all bits of n are zero, remove n from the stack and continue execution behind the THROW.

The phrase "continue execution" is used in descriptions of run-time semantics only (for example, see IF).

For execution semantics the phrase "do nothing" is used (for example, see [IF][1]).

So a better wording is:

If all bits of n are zero, remove n from the stack and do nothing more.


[1] For [IF] it could also say "remove flag from the stack", since otherwise it looks like a mismatch of the stack diagram and the text of the semantic description (see also 2.2.4.2 Glossary semantic description; a stack diagram is a normative part of a semantic description).

Reply New Version