Skip Menu |
Report information
Id: 132076
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: vovan-ve [at] yandex.ru
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Date: Wed, 13 Sep 2017 22:31:05 +0800
Subject: next/last controls loop from exception stack instead of lexical loop
From: Vovan-VE <vovan-ve [...] yandex.ru>
Hello.
 
I'm using rakudo release 2017.07. I'm sure I hit a bug. I could not find something similar in google, sorry if it is duplicate.
Here is code:
 
Show quoted text
 
use v6.c;
 
sub foo($v) {
    # Some loop which does a cool stuff
    for ^1 {
        # Fail in some edge case
        die "BOO!"      if 2 == $v;
        say "inner $v";
    }
}
 
for 1..3 -> $i {
    say "start outer $i";
    try {
        foo($i);
        CATCH {
            default {
                .say;
                last; # it should be applied too lexical `for 1..3` but it controls outsourced loop from exception stack
            }
        }
    }
    say "end outer $i";
}
say "end";
 
Code and actual/expected output are here: https://gist.github.com/anonymous/6912bd53ce24af0d76d62d522dfc0b94 .
 
Best regards.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org