[squeak-dev] The Inbox: Kernel-ct.1292.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Jan 6 09:42:56 UTC 2020


Note Squeak's object events: #when:send:to:. There, "when" requires an event object as a look-up key in the event map. Usually a Symbol.

Best,
Marcel
Am 03.01.2020 07:43:42 schrieb Jakob Reschke <forums.jakob at resfarm.de>:
Note that VA Smalltalk has a legacy approach to exceptions that precedes the ANSI standard. It uses #when:do: in place of #on:do:. (Nowadays it also supports #on:do: but not for old-style exceptions in applications.) Might not a blocker for the proposed nomenclature, but you should at least be aware of it.

<commits at source.squeak.org [mailto:commits at source.squeak.org]> schrieb am Fr., 3. Jan. 2020, 02:21:

A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ct.1292.mcz [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]!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200106/73da0a41/attachment.html>


More information about the Squeak-dev mailing list