What would Squeak be like without non-local returns

Rob Withers reefedjib at yahoo.com
Thu Nov 8 06:22:59 UTC 2007


----- Original Message ----- 
From: "Ralph Johnson" <johnson at cs.uiuc.edu>
To: "The general-purpose Squeak developers list" 
<squeak-dev at lists.squeakfoundation.org>
Sent: Wednesday, November 07, 2007 9:55 PM
Subject: Re: What would Squeak be like without non-local returns


> On 11/7/07, Andreas Raab <andreas.raab at gmx.de> wrote:
>> Ralph Johnson wrote:
>> > Consider the code
>> >
>> > object eventual: [...  ^3]
>> > ...
>> > ^4
>> >
>> > Depending on the missing code, it could return either 3 or 4.  If not,
>> > something is very strange, and the language is no longer Smalltalk.
>>
>> Not at all. Eventual/future sends introduce a new unit of concurrency
>> and the only thing we're arguing is whether that second unit of
>> concurrency will be executed before the first one. In E/Croquet this is
>> not possible, but it is really no different from, e.g.,
>>
>> Object>>foo
>>    [^3] forkAt: Processor activePriority-1.
>>    ^4
>>
>> When you run this, it will return 4 (every time) and fall over the
>> non-local return later (every time).
>
> But that wasn't what I said.  Your code is different from mine.  Note the 
> ...
>
> For example,
>
> Object >>foo
>  [^3] fork.
>  self halt.
>  ^ 4
>
> returns 3.

No, this halts, on the calling Process, and signals a BlockCannotReturn 
Error, on the forked Process, presumably because the returnContext is nil. 
Without the halt and with any number of statements (...), it would return 3.

Rob 




More information about the Squeak-dev mailing list