gforth
[Top][All Lists]
Advanced

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

Re: [gforth] Question about catch when using objects.fs


From: Josh Grams
Subject: Re: [gforth] Question about catch when using objects.fs
Date: Tue, 20 Jan 2015 17:31:28 -0500

On 2015-01-20 02:50PM, Philip Smith wrote:
>m: this ['] foo1 catch ;m method foo2
>
>fooy foo2 .s cr
><2> -1230974988 -2700

Yeah, you have to watch out for the stack depth when CATCH returns
through THROW. It restores it to the original depth (minus the XT
that you executed). So you still have space on the stack from
`this`. But the actual values are arbitrary -- it depends on what
the intervening code has done to the stack before the THROW.

So for instance:

: a -2700 throw ;
: b 12345 67890 11111 33333 ['] a catch ;
b .s cr

--Josh



reply via email to

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