Hi all,
I have a surprising phenomenon best explained by two code samples.
This one works as expected:
: foo-throw -888 .s throw ;
: foo-catch ['] foo-throw catch .s ;
0sp foo-catch
and yields:
Stack<10> -888
Stack<10> -888
When I complicate the invocation by passing another xt to the called word (in the real code I'm doing this for a reason), I will receive the throw code twice on the catch side, like so:
: bar-doit ( -- ) ." doing it!" cr ;
: bar-throw ( xt -- ) execute -999 .s throw ;
: bar-catch ( -- ) ['] bar-doit ['] bar-throw catch .s ;
0sp bar-catch
which yields:
doing it!
Stack<10> -999
Stack<10> -999 -999
Is this expected and I don't see something obvious or if not is there a workaround?
Thanks, Frank