On Sat, Jun 27, 2020 at 5:39 AM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote: > > How would you see rewriting that in a hypothetical core 'try'? I > suggest for example: > > use feature 'try'; > > try { > somefunc(); > } > catch my $e (isa X::SomeException) { say "Red" } > catch my $e (=~ m/^Cannot do a thing /) { say "Blue" } > TBH I'd be content with just ... try { ... } catch my $e { if ($e isa X::SomeException) { ... } elsif ($e =~ m/^Cannot do a thing/) { ... } else { ... } } finally { ... } ..but I'm not usually the most imaginative when it comes to new syntax, and the smartmatch debacle showed us that there are many wrong ways to do it :)Thread Previous | Thread Next