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

"@list is copy" leads to dependent default parameters not updating #3422

Closed
p6rt opened this issue Jul 3, 2014 · 4 comments
Closed

"@list is copy" leads to dependent default parameters not updating #3422

p6rt opened this issue Jul 3, 2014 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jul 3, 2014

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

Searchable as RT122220$

@p6rt
Copy link
Author

p6rt commented Jul 3, 2014

From pjablons@conncoll.edu

10​:37 ren1us m​: sub a(@​list is copy, $l = @​list.elems) { say "Elems​: " ~ @​list.elems; say "l​: $l"; }; a(<a b c d e f g>); a(<a b c>);
10​:37 camelia rakudo-moar cce7f9​: OUTPUT«Elems​: 7␤l​: 7␤Elems​: 3␤l​: 7␤»
10​:37 ren1us m​: sub a(@​list, $l = @​list.elems) { say "Elems​: " ~ @​list.elems; say "l​: $l"; }; a(<a b c d e f g>); a(<a b c>);
10​:37 camelia rakudo-moar cce7f9​: OUTPUT«Elems​: 7␤l​: 7␤Elems​: 3␤l​: 3␤»
10​:45 colomon_ sure looks like a rakudobug
10​:45 * ren1us submits
10​:47 jnthn What the thunk...
10​:48 jnthn I think the first one goes through the slow-path binder thanks to the "is copy"
10​:49 ren1us m​: class A { method test(@​list is copy, $l = @​list.elems) { say "Elems​: " ~ @​list.elems; say "l​: $l"; }; }; my $a = A.new; $a.test(<a b c d e f g>); $a.test(<a b c>);
10​:49 camelia rakudo-moar cce7f9​: OUTPUT«Elems​: 7␤l​: 7␤Elems​: 3␤l​: 7␤»
10​:49 jnthn So the bug is probably in there.

@p6rt
Copy link
Author

p6rt commented Sep 2, 2015

From @usev6

This works now as expected (on 'nom' and 'glr')​:

$ perl6-m -e 'sub a(@​list is copy, $l = @​list.elems) { say "Elems​: " ~ @​list.elems; say "l​: $l"; }; a(<a b c d e f g>); a(<a b c>)'
Elems​: 7
l​: 7
Elems​: 3
l​: 3

I added a test to S06-traits/is-copy.t with commit Raku/roast@4747cd49fc

I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 2, 2015

From @usev6

This works now as expected (on 'nom' and 'glr')​:

$ perl6-m -e 'sub a(@​list is copy, $l = @​list.elems) { say "Elems​: " ~ @​list.elems; say "l​: $l"; }; a(<a b c d e f g>); a(<a b c>)'
Elems​: 7
l​: 7
Elems​: 3
l​: 3

I added a test to S06-traits/is-copy.t with commit Raku/roast@4747cd49fc

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Sep 2, 2015

@usev6 - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Sep 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant