[Cuis-dev] ProgressInitiationException sendNotificationsTo: will bypass all inner blocks

Juan Vuletich juan at jvuletich.org
Fri Apr 30 11:27:16 PDT 2021


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



More information about the Cuis-dev mailing list