[Cuis-dev] ProgressInitiationException sendNotificationsTo: will bypass all inner blocks
Juan Vuletich
juan at jvuletich.org
Sat May 1 16:24:35 PDT 2021
Thanks Nicolas!
Your fix is at GitHub now, together with 5 new tests (in
BaseImageTests.pck.st) that document the correct behavior.
Cheers,
On 5/1/2021 6:41 PM, Nicolas Cellier via Cuis-dev wrote:
> Hi Juan,
> Here is the minimal change
> I didn't even try to honor eventual outer...
>
> Le ven. 30 avr. 2021 à 20:27, Juan Vuletich via Cuis-dev
> <cuis-dev at lists.cuis.st> a écrit :
>> Hi Nicolas,
>>
>> On 4/27/2021 12:45 PM, Nicolas Cellier via Cuis-dev wrote:
>>> Hi all,
>>> If you execute (ProgressInitiationException testWith), you'll see that
>>> a debugger opens due to ZeroDivide exception at step 5.
>>>
>>> If you execute (ProgressInitiationException testWithout), that is
>>> without catching the ProgressInitiationException , you'll see that the
>>> progress continues to step 10, the ZeroDivide exception being caught
>>> by inner on:do: handler.
>>>
>>> Though, the purpose is to catch the ProgressInitiationException ,
>>> prevent a progress bar to open, and resume without further interfering
>>> with protected block evaluation (the receiver of outer on:do:).
>>> Progress bar opening apart, the behavior should not be altered with or
>>> without the handler. This is currently broken.
>>>
>>> I think that this could be achieved by letting sendNotificationsTo:
>>> use resumeEvaluating:. This will have a side effect that (on:
>>> ProgressInitiationException do:) will be re-entrant and thus catch all
>>> the inner ProgressInitiationException instead of only one. In Squeak,
>>> that can't work, because expectations are more complex, but maybe
>>> that's the desired behavior in Cuis.
>> I turned those rather opaque methods into two scripts:
>> "A"
>> [
>> [ProgressInitiationException testInnermost]
>> on: ProgressInitiationException
>> do: [ :ex | ex sendNotificationsTo: [ :min :max :curr |
>> Transcript show: min printString, ' ', max printString, ' ', curr
>> printString; newLine ]]
>> ]
>> on: ZeroDivide
>> do: [ :ex | ex resume]
>> "B"
>> [
>> [ProgressInitiationException testInnermost]
>> on: ZeroDivide
>> do: [ :ex | ex resume]
>> ]
>> on: ProgressInitiationException
>> do: [ :ex | ex sendNotificationsTo: [ :min :max :curr |
>> Transcript show: min printString, ' ', max printString, ' ', curr
>> printString; newLine ]]
>>
>> The only difference is the nesting of the exception handlers. Running A,
>> both exceptions are catched, and 1..10 is printed. Running B, the
>> ZeroDivide is not catched and at 5 a debugger opens. This looks like a bug.
>>
>> Can you post the patch you suggest?
>>
>> Thanks,
>>
>> --
>> Juan Vuletich
>> www.cuis-smalltalk.org
>> https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
>> https://github.com/jvuletich
>> https://www.linkedin.com/in/juan-vuletich-75611b3
>> @JuanVuletich
>>
>> --
>> Cuis-dev mailing list
>> Cuis-dev at lists.cuis.st
>> https://lists.cuis.st/mailman/listinfo/cuis-dev
--
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich
More information about the Cuis-dev
mailing list