Skip Menu |

This queue is for tickets about the Perl6-Controls CPAN distribution.

Report information
The Basics
Id: 122143
Status: resolved
Priority: 0/
Queue: Perl6-Controls

People
Owner: Nobody in particular
Requestors: cpan [...] zoffix.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: FIRST phaser fires at its position in source, instead of at the start of iteration
The expected output is for the `(` paren to precede all the output: use strict; use warnings; use 5.022; use Perl6::Controls; my @animals = qw/ kitty cat tiger cat camelia butterfly /; for (@animals) -> $animal, $group { say " '$animal' => '$group',"; LAST { say ")\n" } FIRST { say "(\n" } } # OUTPUT: # 'kitty' => 'cat', # ( # # 'tiger' => 'cat', # 'camelia' => 'butterfly', # ) -- Cheers, ZZ [ https://metacpan.org/author/ZOFFIX ]
Subject: Re: [rt.cpan.org #122143] FIRST phaser fires at its position in source, instead of at the start of iteration
Date: Tue, 20 Jun 2017 12:39:06 -0400
To: bug-Perl6-Controls [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Definitely a limitation. Which I've now documented. Unfortunately, one I have no idea how to overcome. Any suggestions would be most welcome. :-) Damian
On Tue Jun 20 12:40:34 2017, damian@conway.org wrote: Show quoted text
> Any suggestions would be most welcome. :-)
Don't have any suggestions, other than some hacky time travel with BEGIN blocks: perl -E 'for (qw/a b c/) { state @firsts; (shift @firsts)->() while @firsts; say "meow"; BEGIN { push @firsts, sub {say 42} }; BEGIN { push @firsts, sub {say 70} }; say "moo"; }' 42 70 meow moo meow moo meow moo -- Cheers, ZZ [ https://metacpan.org/author/ZOFFIX ]
Subject: Re: [rt.cpan.org #122143] FIRST phaser fires at its position in source, instead of at the start of iteration
Date: Tue, 20 Jun 2017 17:47:13 +0000
To: bug-Perl6-Controls [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Yes, I considered something like that. It may be possible, but I will have to define keywords to cover every possible loop, so I can catch them all and install the necessary magic. :-( I've ToDo'd it. Thanks again, Damian