Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't declare and list-bind in Rakudo #2354

Closed
p6rt opened this issue Feb 6, 2011 · 4 comments
Closed

Can't declare and list-bind in Rakudo #2354

p6rt opened this issue Feb 6, 2011 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 6, 2011

Migrated from rt.perl.org#83512 (status was 'resolved')

Searchable as RT83512$

@p6rt
Copy link
Author

p6rt commented Feb 6, 2011

From @masak

<masak> rakudo​: my %info = x => 1, y => 2; my ($x, $y) := %info; say
($x, $y).perl
<p6eval> rakudo 684fdf​: OUTPUT«Not enough positional parameters
passed; got 1 but expected 2␤ in 'infix​:<​:=>' at line 1␤ in main
program body at line 22​:/tmp/kudgcUuXVo␤»
<masak> jnthn​: should something like that work?
<jnthn> masak​: Can't remember if you need to explicitly capture-ize the RHS
<jnthn> rakudo​: my %info = x => 1, y => 2; my ($x, $y) := \%info; say $x, $y;
<p6eval> rakudo 684fdf​: OUTPUT«Not enough positional parameters
passed; got 1 but expected 2␤ in 'infix​:<​:=>' at line 1␤ in main
program body at line 22​:/tmp/LsMKGXbXkQ␤»
<jnthn> er, wtf
<jnthn> I'm sure that _did_ work...
<masak> yeah
<jnthn> oh, wait
<jnthn> rakudo​: my %info = x => 1, y => 2; my (($x, $y)) := %info; say $x, $y;
<p6eval> rakudo 684fdf​: OUTPUT«12␤»
<jnthn> ah.
<jnthn> That's telling.
<masak> jnthn​: can I submit as a rakudobug that it doesn't work
without the double parens?
<jnthn> masak​: Check if the spec says it should first.
<masak> oki.
<masak> jnthn​: hm.
<masak> (​:@​even, :@​odd) := |classify { $_ % 2 ?? 'odd' !! 'even' }, @​list;
<masak> seems the | is needed, too.
<masak> rakudo​: my %info = x => 1, y => 2; my ($x, $y) := |%info; say
($x, $y).perl
<p6eval> rakudo 684fdf​: OUTPUT«Not enough positional parameters
passed; got 1 but expected 2␤ in 'infix​:<​:=>' at line 1␤ in main
program body at line 22​:/tmp/1QbM2ij3UZ␤»
<masak> but that doesn't work either, so... :)
* masak submits rakudobug
<jnthn> I'm not sure | knows what to do there
<jnthn> oh, or maybe it does...but does something wrong, hmm
<jnthn> I bet there's some screw-up somehwere in coercion to capture.

@p6rt
Copy link
Author

p6rt commented Dec 18, 2012

From @timo

< benabik> r​: my @​list = 1..4; my (@​even, @​odd); :(​:@​even, :@​odd) :=
classify { $_ % 2 ?? 'odd' !! 'even' }, @​list; say @​even, @​odd
<+p6eval> rakudo 7794ed​: OUTPUT«2 41 3␤»
< timotimo> r​: my @​list = 1..4; my (​:@​even, :@​odd) := classify { $_ % 2
?? 'odd' !! 'even' }, @​list; say @​even, @​odd
<+p6eval> rakudo 7794ed​: OUTPUT«2 41 3␤»

Although the exact way to do this has changed since this ticket was
created, it's implemented and apparently working as intended now.

Added a test to roast in 817476a. (t/spec/S02-names-vars/signature.t)

@p6rt
Copy link
Author

p6rt commented Dec 18, 2012

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 18, 2012

@timo - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Dec 18, 2012
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant