What would Squeak be like without non-local returns

Andreas Raab andreas.raab at gmx.de
Thu Nov 8 06:25:16 UTC 2007


Hi Ralph -

Sorry, I thought it was clear that I was giving conceptual answer. But 
if you need a literal one, here it is:

TestIsland>>initialize
   eventQueue := SharedQueue new.
   eventQueue nextPut:[self foo].
   self runEventLoop.

TestIsland>>runEventLoop
   [true] whileTrue:[eventQueue next value]

TestIsland>>foo
   eventLoop nextPut:[^3].
   self halt.
   ^4

This will result in 4 being returned from foo unless you introduce a 
different model of concurrency. In any case, neither of my examples 
qualifies for "the language is no longer Smalltalk" which was my point.

Cheers,
   - Andreas

Ralph Johnson wrote:
> 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.
> 
> 




More information about the Squeak-dev mailing list