[squeak-dev] Exception patterns (The Inbox: Kernel-ct.1292.mcz)

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Oct 9 14:41:09 UTC 2020


Hi Marcel, Hi Chris,


thanks for your feedback. I see your point of complexity, still, I think BlockClosure #& etc. could be a nice concept, but it would rather belong in an own repository (such as Xtreams, for example).


See Kernel-ct.1292/2 for the next attempt. :-)

<http://www.hpi.de/>

@Chris: You're right with your interpretation, I'm aiming to get rid of this low-level #pass sends and all the condition logic inside handlerActions.

> (wait, is that, #on:do:on: ?  I'm confused on this one...)

Oops, this should have been #on:do:on:do: instead. But I fear this would be over-complicated anyway ...

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Freitag, 9. Oktober 2020 08:57:05
An: Chris Muller; squeak-dev
Betreff: Re: [squeak-dev] Exception patterns (The Inbox: Kernel-ct.1292.mcz)

Hi Christoph,

you are proposing an interface to avoid having to deal with Exception >> #pass and #resume:. I like #on:when:do:, maybe renamed to: #on:satisfying:do:. I do not like your & syntax because it would mix Exception, ExceptionSet, and BlockClosure -- which may be hard to understand and debug.

Bset,
Marcel

Am 09.10.2020 03:15:43 schrieb Chris Muller <asqueaker at gmail.com>:

Hi Christoph,

Are these equivalent --

On Thu, Jan 2, 2020 at 7:58 PM Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de<mailto:Christoph.Thiede at student.hpi.uni-potsdam.de>> wrote:
Outlook jumbled my message completely. Here the examples again:

[self model merge]
        on: MCMergeResolutionRequest
                & [:request | request merger conflicts notEmpty]
        do: [:request | request resume: true].

equal to:

  [self model merge]
        on: MCMergeResolutionRequest
        do:
           [:request | request merger conflicts notEmpty
                ifTrue: [request resume: true]
                ifFalse: [request pass] ]

?


[client unusedBytecode]
        on: MessageNotUnderstood
                & [:ex | ex receiver == client]
                & [:ex | ex message selector == #unusedBytecode]
        do: [self error: 'unusedBytecode'].

equal to

   [client unusedBytecode]
         on: MessageNotUnderstood
         do:
               [:ex | (ex receiver == client and: [ ex message selector == #unusedBytecode ])
                      ifTrue: [ self error: 'unusedBytecode' ]
                      ifFalse: [ ex pass ] ]

?

Not sure if I fully understood it, but is it just a reformat of the syntax?  Or something more empowering?



references := [self resolvePackageSpecReferences: packageSpec gofer: gofer]
        on: [self class retryPackageResolution] & (Error , GoferRepositoryError)
        do: [:ex | retryCount >= 2 ifFalse: [
                ex return: #() ]
        on: [self class retryPackageResolution] & GoferRepositoryError.
                Transcript showln: 'gofer repository error: '; show: ex description printString; show: '...ignoring'.
                (repositoryError := ex) resume: #()].

(wait, is that, #on:do:on: ?  I'm confused on this one...)

  - Chris


sz := 1024*1024*1024*1024.
self
        should: [Array new: sz]
        raise: OutOfMemory, (Error & [:ex | ex messageText includesSubstring: 'basicNew: with invalid argument']).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201009/dca64f6c/attachment-0001.html>


More information about the Squeak-dev mailing list