[squeak-dev] Implementing control operators

Bert Freudenberg bert at freudenbergs.de
Thu Apr 14 10:43:28 UTC 2011


On 14.04.2011, at 05:20, Ralph Johnson wrote:

> On Wed, Apr 13, 2011 at 5:42 PM, Frank Shearar
> <frank.shearar at angband.za.org> wrote:
> 
>> But I suppose I'm really asking this: is it _necessary_ to use primitive
>> 199, or could one in _principle_ implement exception handling solely by
>> in-image stack manipulation?
> 
> Yes, you can implement exception handling by normal Smalltalk code,
> without any special primitives.   Primitives make it go faster, and
> they are necessary to trap blocks that leave your exception handler,
> but the first dozen exception handling packages in Smalltalk (and
> before the ANSI standard there are a lot of incompatible exception
> handling systems for Smalltalk) all did it without primitives.
> 
> -Ralph Johnson

Squeak's exception-related primitives are purely an optimization:

SystemNavigation default browseAllSelect: [:ea | ea primitive between: 195 and: 197] 

I just removed those three primitive invocations, and the system seemed to still work fine. Prims 198 and 199 are only used to mark methods, they don't actually do anything.

Unless I am mistaken, the interpreter itself knows nothing about exceptions. 

- Bert -





More information about the Squeak-dev mailing list