What would Squeak be like without non-local returns

Andreas Raab andreas.raab at gmx.de
Wed Nov 7 05:38:17 UTC 2007

Rob Withers wrote:
> Well, now I can't find that statement, but I was sure I had read it on 
> erights or Mark's thesis.  I searched and found nothing.  It may have 
> been a statement regarding eventual-sending specifically with non-local 
> return.  It IS strange thinking about the correct behavior of an 
> expression:
> object eventual ifTrue: [^3].
> ^4
> What should be the result?

Without any question, 4. Since ifTrue:[] is sent eventual it will return 
immediately (answering a promise), and the method will continue and 
return 4. There is absolutely no question about it.

When the eventual ifTrue: is executed it will barf because it will try 
to return from a method with no home but that's the way out-of-scope 
blocks go. It's just as well-defined as a non-local return from an 
out-of-scope block today, e.g.,


   self createBlock value.

This will simply signal BlockCannotReturn and the eventual ifTrue:[] 
will - and should - do the same.

   - Andreas

More information about the Squeak-dev mailing list