[Cuis-dev] A bug in handling nested #outer exceptions

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon May 3 13:13:27 PDT 2021


Hi all,
the only example I encountered so far was in Gofer:

    version := [ aWorkingCopy newVersion ]
        on: MCVersionNameAndMessageRequest
        do: [ :notifcation |
            self message isNil
                ifTrue: [ message := notifcation outer last ].
            notifcation resume: (Array with: notifcation suggestedName
with: self message) ].

it assumes that outer handler will resume.
Or more exactly, it assumes that the defaultAction will be resumed:
(when there is no outer handler)
The default action is to open a Dialog, whose answer used to be:

MCSaveVersionDialog>>accept
    self answer:
        (Array
            with: (self findTextMorph: #versionName) text asString
            with: (self findTextMorph: #logMessage) text asString)

It would not even work in modern Squeak since 2014: a 3rd element has
been added to the Array answered...

The code could as well be
                ifTrue: [ message := notifcation defaultAction second ].

But maybe we want to support nested handlers with an outer handlers
doing more ...

Le lun. 3 mai 2021 à 18:29, Jaromir Matas via Cuis-dev
<cuis-dev at lists.cuis.st> a écrit :
>
> Hi Juan,
>
>
>
> I agree #outer doesn’t have much use; my objective was to learn the implementation and incidentally I discovered it’s broken… so just reporting it :) It might be worth mentioning the bug in the image so that people don’t struggle with the code… Or integrate the test as expected failure to keep track of the issue?
>
>
>
> Best regards,
>
> Jaromir
>
>
>
> From: Juan Vuletich
> Sent: Monday, May 3, 2021 18:12
> To: Discussion of Cuis Smalltalk
> Cc: Jaromir Matas
> Subject: Re: [Cuis-dev] A bug in handling nested #outer exceptions
>
>
>
> On 5/2/2021 2:28 PM, Jaromir Matas via Cuis-dev wrote:
> >
> > path := ''.
> >
> > [path := path, '1'.
> >
> >               [path := path, '2'.
> >
> >                            [1/0] on: ZeroDivide do: [:ex | ex outer.
> > path := path, '5'. ex return].
> >
> >                            path := path, '6'
> >
> >               ] on: ZeroDivide do: [:ex | ex outer. path := path, '4'.
> > ex resume].
> >
> >               path := path, '7'
> >
> > ] on: ZeroDivide do: [:ex | path := path, '3'. ex resume].
> >
> > path
> >
>
> Hi Jaromir,
>
> I agree that it looks broken. But I can't really see what is the purpose
> of #outer, or think an example where this is relevant.
> Anybody knows better?
>
> 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


More information about the Cuis-dev mailing list