VisualAge Smalltalk has, in addition to the standard #on:do:, #when:do:, ..., #when:do:#when:do:#when:do:#when:do:#when:do:, with the last four mapping to #whenOneOf:doMatching:, taking two arrays. It's easy enough to add your own methods like on: exn1 do: act1 on: exn2 do: act2 "An imperfect emulation of VAST's #when:do:when:do:" ^[self on: exn1 do: act1] on: exn2 do: act2 on: exn1 do: act1 on: exn2 do: act2 on: exn3 do: act3 "An imperfect emulation of VAST's #when:do:when:do:when:do:" ^[[self on: exn1 do: act1] on: exn2 do: act2] on: exn3 do: act3 to BlockClosure. It won't be fast, but your code might be clearer. On Mon, 8 Apr 2019 at 10:21, Tim Mackinnon <tim@testit.works> wrote:
Thanks, I guess that makes sense, although it somehow looks a bit ugly with the nested brackets.. but nothing else springs to mind so maybe Iâll get used to it (and In my case I think itâs likely 2 or 3 different exceptions)
Tim
Sent from my iPhone
On 7 Apr 2019, at 20:43, Richard Sargent < richard.sargent@gemtalksystems.com> wrote:
This last one.
[[self run] on: TestFailure do: [:testEx | ...]] on: Error do: [:error | ...]