[squeak-dev] Re: #ensure: What would you expect?

Bert Freudenberg bert at freudenbergs.de
Fri Dec 2 16:43:28 UTC 2011


On 02.12.2011, at 17:17, Andreas Raab wrote:

> There is only one possibly correct answer which is raising BlockCannotReturn

+1

- Bert -

> , because we're trying to return while we're in the midst of returning already, so there is no place to return to. That answer is implemented by the attached change set.
> 
> BTW, the code duplication between ContextPart>>restart ContextPart>>resume:, ContextPart>>unwindTo:, and Process>>terminate bothers me greatly. The change set only fixes one of these locations (the one triggered by your problem statement) but having such critical code duplicated all over the places can't be good. Any takers?
> 
> Cheers,
>  - Andreas
> 
> On 12/2/2011 15:18, Tobias Pape wrote:
>> Dear All,
>> 
>> given the following class:
>> 
>> Object subclass: #Foo
>>         instanceVariableNames: ''
>>         classVariableNames: ''
>>         poolDictionaries: ''
>>         category: 'Foo'!
>> a
>>         self b: [^ 1].! !
>> 
>> b: aBlock
>> 
>>         [self c: aBlock] ensure: [^ 2].
>> 
>> c: aBlock
>> 
>>         aBlock value.
>>         ^ 3
>> 
>> And you would do
>> 
>> Foo new a
>> 
>> what would you expect?
>> 
>> I am very curious.
>> Please, first guess, then execute.
>> 
>> Best
>> 	-Tobias
>> 
>> 
>> 
>> 
>> 
>> 
> 
> <ContextPart-resume.st>






More information about the Squeak-dev mailing list