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

Re: Adding a try/catch syntax to Perl

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
January 22, 2021 19:09
Subject:
Re: Adding a try/catch syntax to Perl
Message ID:
20210122190929.0b58f114@shy.leonerd.org.uk
On Fri, 22 Jan 2021 13:47:52 -0500
Dan Book <grinnz@gmail.com> 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 rt.cpan.org is still a
thing]:

  https://rt.cpan.org/Ticket/Display.html?id=123918

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About