It won't be fast because it creates multiple blocks, whereas a "native" version would not. To be honest I have not implemented exceptions in my Smalltalk yet, but I want to inline []on:do: constructions. The VAST system I have is 8.6.3, and it supports ANSI Exceptions.
On Tue, 9 Apr 2019 at 00:31, Esteban Maringolo <emaring...@gmail.com> wrote: > Richard, > > I was going to comment the #when:do:[when:do:] approach of VAST [1]. > > Why do you say it won't be fast? Because of the multiple exception > handlers in the call stack? > > I think that some construct might be used to obtain the same as the > #when:do:when:do: but using a chained approach instead. > > Regards, > > [1] AFAIR when I used VAST (+a decade ago) it didn't have "ANSI" > exceptions. > > Esteban A. Maringolo > > El lun., 8 abr. 2019 a las 0:49, Richard O'Keefe (<rao...@gmail.com>) > escribió: > > > > 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.sarg...@gemtalksystems.com> wrote: > >> > > >> > > >> > This last one. > >> > > >> > [[self run] > >> > on: TestFailure > >> > do: [:testEx | ...]] > >> > on: Error > >> > do: [:error | ...] > >> > >> > >