gforth
[Top][All Lists]
Advanced

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

[gforth] Question about catch when using objects.fs


From: Philip Smith
Subject: [gforth] Question about catch when using objects.fs
Date: Tue, 20 Jan 2015 14:50:48 -0700

Sample code follows
*************
require objects.fs
cr
object class
m: -2700 throw ;m method foo1
m: this ['] foo1 catch ;m method foo2
end-class foo

: a -2800 throw ;
: b ['] a catch ;

foo heap-new constant fooy

fooy foo2 .s 2drop cr
\ output is as follows
\ <2> -1230974988 -2700

b .s drop cr
\ output is as follows
\ <1> -2800
******************

Ok what i am questioning is the extra number returned when catch is used inside a object!
In my example i simply show catch used inside an object called fooy and inside a colon definition.
The colon defined word does what i expect for catching the throw in word a!
The object method foo2 seems to return the throw from method foo1 but also returns another value that seems to be related to the object but i am not sure what it is!

--
                \|||/
-----0oo---( o o )---oo0------
                (_)
From the hand of PKS


reply via email to

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