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

is default on a hash prevents autovivification, but doesn't work on its own either #5872

Open
p6rt opened this issue Dec 7, 2016 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Dec 7, 2016

Migrated from rt.perl.org#130293 (status was 'new')

Searchable as RT130293$

@p6rt
Copy link
Author

p6rt commented Dec 7, 2016

From @moritz

moritz​: m​: my %h is default([]); %h<a>.push​: 1; %h<b>.push​: 2; say %h
camelia​: rakudo-moar 2d0198​: OUTPUT«{}␤»
moritz​: m​: my %h; %h<a>.push​: 1; %h<b>.push​: 2; say %h
camelia​: rakudo-moar 2d0198​: OUTPUT«{a => [1], b => [2]}␤»
moritz​: does this look like a bug to anybody else?
babydrop​: yeah
moritz​: I was curious whether it created two distinct arrays, but
  didn't expect to see %h empty
* moritz rakudos submitbug

I expected the output from the first to be {a => [1, 2], b => [1, 2]},
or if 'is default' clones the value, {a => [1], b => [2]}.

--
Moritz Lenz
https://deploybook.com/ -- https://perlgeek.de/ -- https://perl6.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant