On Apr 24, 2011, at 12:43 PM, Igor Stasenko wrote:
> On 24 April 2011 13:26, Stéphane Ducasse <[email protected]> wrote:
>> here is a simpler case
>>
>> do: aBlock
>>
>> x := 5.
>> [aBlock value] ensure: [x :=3]
>>
>> testDo
>> "self run: #testDo"
>>
>> self do: [ self error].
>> self assert: x = 3
>>
>>
>> and I do not understand why ensure is not executed :(
>> because I always want the ensure to happen not only on ifCurtailed:
>>
>
> error are not causing ensure block to trigger.
so what is causing them to trigger.
I always thought ensure: was really giving that warranty. So this is really
scary to me.
I wrote that and this is green.
testDo2
"self run: #testDo2 1 run, 1 passes, 0 expected failures, 0 failures, 0
errors, 0 unexpected passes"
[self do: [ self error]
] on: Error do: [:ex | ].
self assert: x = 3.
To me it means that I should not use ensure because it makes no sense to wrap
the withOrganizer in a on: do: block
outside. So I do not see the real use of ensure:
Shit.....
Stef
> only after you either abandon or proceed, an ensure block will be executed.
>
>
>> Stef
>>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>