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

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sat May 1 14:41:18 PDT 2021


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 4580-ProgressInitiationException-nice-2021May01-23h24m-nice.002.cs.st
Type: application/octet-stream
Size: 332 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210501/a113e593/attachment-0001.obj>


More information about the Cuis-dev mailing list