[perl #105872] [BUG] 42, 44, 22 -> *@a { say @a.perl }

[email protected] ("Zoffix Znet via RT")
Newsgroups perl.perl6.compiler
Message-ID <[email protected]>
On Sat, 10 Dec 2011 18:37:03 -0800, [email protected] wrote:
> JimmyZ> nom: if 42 -> *@_ { say @_.perl }
> p6eval> nom 1f9310: OUTPUT«Array.new()␤»
> 
> JimmyZ> niecza: if 42, 44, 22 -> *@a { say @a.perl }
> p6eval> niecza v12-10-ga8ad0e9: OUTPUT«(42, 44, 22)␤»
> 
> JimmyZ>nom: if 42, 44, 22 -> *@a { say @a.perl }
> p6eval>nom 1f9310: OUTPUT«Array.new()␤»
> 
> jnthn> JimmyZ: oh, oddness...
> jnthn> JimmyZ: Anyway, I can probably fix it. Feel free to submit a ticket.
> 
> JimmyZ> nom: while 42, 44, 22 -> *@a { say @a.perl; last }
> p6eval> nom 70d715: OUTPUT«Array.new()␤»
> JimmyZ> niecza: while 42, 44, 22 -> *@a { say @a.perl; last }
> p6eval> niecza v12-11-g20a790d: OUTPUT«(42, 44, 22)␤»
> 

Thank you for the report. This is now fixed.

Fix:  https://github.com/perl6/nqp/commit/8e7201eb64
      https://github.com/rakudo/rakudo/commit/dfb6d951d7
      https://github.com/rakudo/rakudo/commit/ef1d22f4c1
Test: https://github.com/perl6/roast/commit/aa90737df1


On Mon, 11 Jan 2016 18:43:32 -0800, awwaiid wrote:
> Putting parens around the signature makes it work:
> 
> $ perl6 -e 'while 42, 44, 22 -> (*@a) { say @a.perl; last }'
> [42, 44, 22]
> 
> $ perl6 -e 'if 42, 44, 22 -> (*@a) { say @a.perl }'
> [42, 44, 22]
> 
> I don't know if the parenthesis SHOULD be required or not.

No, with parentheses you're taking a single positional arg and then unpacking its Capture.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.