develooper Front page | perl.perl5.porters | Postings from January 2021

Re: Adding a try/catch syntax to Perl

Thread Previous | Thread Next
Philip R Brenan
January 22, 2021 20:42
Re: Adding a try/catch syntax to Perl
Message ID:
Might it be better to have the exception in *$@* as "in the best it is"?
This would save updates to documentation, reduce user confusion and allow
the *($e)* to be dispensed with entirely in the most common use cases.  Of
course if one wishes to spend one's time needlessly typing parentheses, we
should all defend to the death the absolute right to do so. But for those
of us who prefer to get on with life and opt to use Perl because it is the
most expressive of languages, because it is not only not Java nor
Javascript but is in fact something altogether brighter and better, if a
small amount of programming could save so much effort, then  "If t'wer
done, when tis done, t'were well it were done quickly" would be seem to be
the best solution by far for the mortal rest of us.  "Chi vorrebbe
caricarsi di grossi fardelli ... "

On Fri, Jan 22, 2021 at 7:09 PM Paul "LeoNerd" Evans <>

> On Fri, 22 Jan 2021 13:47:52 -0500
> Dan Book <> wrote:
> > The parentheses also enable future extensions with arbitrary syntax
> > such as typed dispatch.
> ^-- yes, that.
> I have been thinking several steps ahead here. While not a part of my
> *current* proposal for core, I do aim that one day we can
>   try { ... }
>   catch ($e isa MyApp::SomeWeirdException) { ... }
>   catch ($e isa Perl::X::ENOENT) { ... }
>   catch ($e) { default here }
> So the parens are necessary for those later forward steps.
> If you want to see the full and varied discussions about the history of
> that part of Syntax::Keyword::Try, see [while is still a
> thing]:
> --
> Paul "LeoNerd" Evans
>      |
>  |


Phil <>

Philip R Brenan <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About