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

Chris Muller asqueaker at gmail.com
Fri Oct 9 01:14:56 UTC 2020


Hi Christoph,

Are these equivalent --

On Thu, Jan 2, 2020 at 7:58 PM Thiede, Christoph <
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/20201008/45962292/attachment.html>


More information about the Squeak-dev mailing list