develooper Front page | perl.perl5.porters | Postings from July 2020

Re: On actually implementing core features [was: Re: Dual-life perl5-or-7 code and prototypes - impossible?]

Thread Previous | Thread Next
From:
Branislav Zahradník
Date:
July 4, 2020 11:52
Subject:
Re: On actually implementing core features [was: Re: Dual-life perl5-or-7 code and prototypes - impossible?]
Message ID:
CAB=rbO=X4U26n3oN5+r0MxxaqOQX4CeKcOWPXMSX=OskhqM2mw@mail.gmail.com
On Sat, 4 Jul 2020 at 13:27, Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

> On Sat, 4 Jul 2020 12:14:15 +0200
> Branislav Zahradník <happy.barney@gmail.com> wrote:
>
>
> `try` block to contain it. The `try` part of `try/catch` syntax exists
> primarily for the benefit of the human programmer, not the perl
> interpreter.
>

This way you are still handling only exceptions ignoring other asynchronous
events.

ad benefit of the human, here I will disagree.
I modified some java code to show an example:

Original method with try/catch:
https://pastebin.com/eSV5AgRd

Modified with  lexical catch:
https://pastebin.com/kHWjTs2r

As a human reader it's easier for me to be notified about possible exit
before exit happens.
(Imagine GPS navigation talking like try/catch block: "200 meters ago you
had to turn left")




> --
> 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