2021-12-17 7:23 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote: > On Tue, 19 Oct 2021 19:25:04 +0100 > "Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote: > > > Using the same internals that makes them work it would be quite easy > > to add the oft-requested try/catch/finally syntax: > > > > try { > > say "This happens first"; > > } > > catch ($e) { > > say "Oops, a failure happened"; > > } > > finally { > > say "This always happens, regardless of success or failure"; > > } > > > > A try/catch/finally can be implemented basically the same way as if it > > was written > > > > { > > defer { "finally" code goes here } > > > > try {} catch($e) ... here as normal > > } > > I've now written a (currently-draft) PR to implement specifically this > bit of try/catch/finally syntax: > > https://github.com/Perl/perl5/pull/19285 > > Whether to allow try/finally without a catch block > I think allowing try/finally results in being used in the production at experimental status. If you haven't decided yet, it is good to forbid try/finally at first implementation.Thread Previous | Thread Next