A new version of Kernel was added to project The Inbox: http://source.squeak.org/inbox/Kernel-ct.1292.mcz
==================== Summary ====================
Name: Kernel-ct.1292 Author: ct Time: 3 January 2020, 2:21:26.297116 am UUID: 95936a10-85a4-734e-a10b-0f87290b70f9 Ancestors: Kernel-nice.1291
Proposal: Implement conditional exception handling on blocks. The nomenclature is inspired from usual practice in .NET languages.
For an impression of possible users, have a look at:
self systemNavigation browseMessageList: ((self systemNavigation allCallsOn: #on:do: and: #pass) intersection: (#(ifTrue: ifFalse: ifTrue:ifFalse: ifFalse:ifTrue:) gather: [:sel | self systemNavigation allCallsOn: sel])) name: 'Potential users of #on:when:do:'
=============== Diff against Kernel-nice.1291 ===============
Item was added: + ----- Method: BlockClosure>>on:when:do: (in category 'exceptions') ----- + on: exceptionOrExceptionSet when: aPredicate do: handlerAction + + ^ self + on: exceptionOrExceptionSet + do: [:exception | + (aPredicate value: exception) + ifTrue: [handlerAction cull: exception] + ifFalse: [exception pass]]!
Item was added: + ----- Method: BlockClosure>>on:when:ensure: (in category 'exceptions') ----- + on: exceptionOrExceptionSet when: aPredicate ensure: aBlock + + ^ self + on: exceptionOrExceptionSet + do: [:exception | + (aPredicate value: exception) + ifTrue: [aBlock value]. + exception pass]!