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

Marcel Taeumel marcel.taeumel at hpi.de
Fri Oct 9 06:57:05 UTC 2020


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/abc454f1/attachment.html>


More information about the Squeak-dev mailing list