Localizing up-arrow

Ralph E. Johnson johnson at cs.uiuc.edu
Mon Oct 19 14:42:10 UTC 1998

At 9:03 PM 10/16/98, Sheldon Nicholl wrote:
>The examples also allow me to add to the list of troubles caused
>by non-local returns: "questionable" style.
>>stream atEnd ifTrue: [^self]
>Why not just say:
>    stream atEnd ifFalse: [...the rest of the method...]
>or maybe better:
>    stream atEnd ifFalse: [self doTheRest]
>I think I can answer this question: because it looks terrible.
>I'll admit I've used it countless times, but almost always with
>a twinge of conscience.

Please quit feeling guilty!  Using a return is definitely good style
here.  Kent Beck's book "Smalltalk Best Practice Patterns" explains

>I just want to plead that in case something like this is adopted, that
>it be done at the image level. It involves far too many operations, way
>too much intelligence for something that should be in the VM, which 
>should consist of simple clean primitives only. Unwinding is something
>that a programmer may want to modify, which is another argument for
>putting it in the image.

There are lots of exception packages that work at the image level.
The only thing that required a VM hack was getting ensure: to catch
returns. Andreas Raab's suggestion that blocks containing an ^ automatically
generate a cannotReturn: lets even that be in the image.  Exceptions are
faster if they are in the VM, but my guess is that they rarely need to
be fast.


More information about the Squeak-dev mailing list