I'd like to implement the proposed Smalltalk ANSI standard exception protocols in Squeak. Is there an exception handling implementation for Squeak relatively complete? Enough so that the ANSI standard exception protocols could implemented using it. I used Hal Hildebrand's implementation when doing this for Smalltalk Express.
In March, Dave Farber posted a Squeak version of exception handling. (Dave: yes, it's very useful ;) Is there a more recent version?)
thanks Bijan. there is not a more recent version. several reasons for this: 1) i have not received any bug reports :) 2) i got sidetracked from some stuff that had sidetracked me from some other stuff that had sidetracked me from working more on exceptions 3) i don't know that i really like PP's interface. at the very least i would what to swap do:handle: for handle:do:.
i did find one bug. i had commented out one snippet of code that checked to see if the exception on the stack was the right type for the handler found. so now, the first handler found will always execute, regardless of the exception type.
if any one has has any fixes, extensions, or more exception definitions, feel free to pass them along.
dave
-- j. david farber oo architect+mentor numenor labs incorporated in sunny boulder colorado dfarber@numenor.com www.numenor.com
I'd like to implement the proposed Smalltalk ANSI standard exception protocols in Squeak. Is there an exception handling implementation for Squeak relatively complete? Enough so that the ANSI standard exception protocols could implemented using it. I used Hal Hildebrand's implementation when doing this for Smalltalk Express.
In March, Dave Farber posted a Squeak version of exception handling. (Dave: yes, it's very useful ;) Is there a more recent version?)
thanks Bijan. there is not a more recent version. several reasons for this:
- i have not received any bug reports :) 2) i got sidetracked from some
stuff that had sidetracked me from some other stuff that had sidetracked me from working more on exceptions 3) i don't know that i really like PP's interface. at the very least i would what to swap do:handle: for handle:do:.
i did find one bug. i had commented out one snippet of code that checked to see if the exception on the stack was the right type for the handler found. so now, the first handler found will always execute, regardless of the exception type.
if any one has has any fixes, extensions, or more exception definitions, feel free to pass them along.
dave
Hi, Dave!
It's been a while since I looked into this, but I believe that Squeak lacks some critical VM support for unwind blocks. But I haven't looked at what your implementation; were you able do everything you needed to do without any VM support? Does your implementation support unwind blocks (the "ensure:" mechanism)? If not, how badly is it missed?
I suggest that whenever there is a disagreement between the proposed ANSI Smalltalk standard and some vendor's implementation, Squeak's exception handling should lean toward the ANSI standard. (E.g., "ensure:" versus "valueNowOrOnUnwindDo:"). Presumably Smalltalk vendors will be gradually migrating toward the standard over the next several years.
-- John
John,
It's been a while since I looked into this, but I believe that Squeak lacks some critical VM support for unwind blocks.
I entirely disagree. The only critical point is detecting non-local returns through the ensured block and given that there is a working exception system this is quite possible by simply breaking the sender of the ensured context. If this is detected correctly by the VM then BlockContext>>cannotReturn: will be activated leading to an exception which can itself be handled by executing of the unwind block and returning control to the original point of execution.
The Jitter VM already detects these broken senders of blocks correctly and for the bytecode interpreter this is a two line fix. BTW, my own attempt to exception used exactly this scheme. Yes, it is sort of a hack but it works and there is no need at all for larger changes to the VM.
Andreas
squeak-dev@lists.squeakfoundation.org