bug-gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #63268] throw|catch behavior: unexpected items at data stack


From: Stephan Rudlof
Subject: [bug #63268] throw|catch behavior: unexpected items at data stack
Date: Mon, 24 Oct 2022 17:28:57 -0400 (EDT)

Follow-up Comment #1, bug #63268 (project gforth):

Trying an explanation; from
  https://gforth.org/manual/Exception-Handling.html
:
----
The Standard Forth way to catch exceptions is catch:

catch ( x1 .. xn xt – y1 .. ym 0 / z1 .. zn error  ) exception “catch”

Executes xt. If execution returns normally, catch pushes 0 on the stack. If
execution returns through throw, all the stacks are reset to the depth on
entry to catch, and the TOS (the xt position) is replaced with the throw
code.
----
'All the stacks are reset to the depth on entry to catch'; so if there are
args at stack before

['] run-thrower_arg catch

, stack depth thereafter reflects this.
*But* obviously - as shown below - these additional positons at stack are
*not* restored to their values before...




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63268>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]