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

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
Ben Bullock
June 21, 2021 10:11
Re: RFC 0004 - defer {} syntax
Message ID:
On Mon, 21 Jun 2021 at 11:16, Eirik Berg Hanssen <> wrote:

> On Mon, Jun 21, 2021 at 3:37 AM Ben Bullock <>
> wrote:
>> I went back and checked, and I've actually said this in all of the
>> messages I've sent on this thread, and so far nobody has pointed out the
>> mistake in my understanding. Is there some way of sneaking out of if{}
>> without arriving at the end of the code?
>   Yes?  Plenty of ways: An exception may sneak out (all the way to the
> first dynamically enclosing eval or similar); a return may sneak out (all
> the way out of the subroutine call); a next/last/redo may sneak out (all
> the way out of the first dynamically enclosing loop with matching label, if
> given); a goto LABEL may sneak out to some arbitrary LABEL.

No, that's not my point. If you have something like this

while (1) {
   if (something) {
      print "Did not execute.\n";
   print "Did execute\n";

you have to come up with something at suddenlyexitif which leaves the if
block which does not execute "print "Did not execute.\n"" but does execute
"print "Did execute\n"", without adding labels.

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