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

Re: Pre-RFC: try/catch/finally and generic finally blocks

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
January 21, 2022 18:52
Subject:
Re: Pre-RFC: try/catch/finally and generic finally blocks
Message ID:
20220121185211.41688d48@shy.leonerd.org.uk
On Fri, 21 Jan 2022 12:35:59 -0600
David Nicol <davidnicol@gmail.com> wrote:

> i therefore expect next, redo, or last in a defer block to next,
> last, or redo the calling loop if any -- but at the end of the block
> with the defer in it, if we ever get there.

Again I ask you to be very clear in the face of exceptions.

How do you expect the following to behave?

  foreach my $i ( 1 .. 5 ) {
    print "Starting $i\n";
    defer {
      print "Deferring $i\n";
      next;
    }
    die "Failing $i";
  }

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