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

Autovivification to make push %h<x>, 5 work in Rakudo #2367

Closed
p6rt opened this issue Feb 12, 2011 · 5 comments
Closed

Autovivification to make push %h<x>, 5 work in Rakudo #2367

p6rt opened this issue Feb 12, 2011 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Feb 12, 2011

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

Searchable as RT84000$

@p6rt
Copy link
Author

p6rt commented Feb 12, 2011

From @masak

<stifynsemons> Another newbie question​: my %g; %g<gamma>.[].push(5)
doesn't auto-vivify hash element gamma. So I have to use my %g;
%g<gamma>=[]; %g<gamma>.[].push(5). Is there a simpler syntax?
<sorear> stifynsemons​: I suspect push %g<gamma>, 5 should work
<stifynsemons> push %g<gamma>, 5 doesn't work in 201101 rakudo star
<sorear> (%g<gamma> //= []).push(5) will definitely work
<masak> rakudo​: my %g; push %g<gamme>, 5; say %g.perl
<p6eval> rakudo : OUTPUT«Method '!fill' not found for invocant of class '' [...]
<moritz_> I'm pretty sure both the sub and method form should work
* masak is surprised the spectests wouldn't pick something like that up.
* masak submits rakudobug
<masak> stifynsemons++
<moritz_> masak​: there are tests for that. They are just fudged :-)

@p6rt
Copy link
Author

p6rt commented Nov 5, 2012

From @jnthn

On Sat Feb 12 13​:15​:58 2011, masak wrote​:

<stifynsemons> Another newbie question​: my %g; %g<gamma>.[].push(5)
doesn't auto-vivify hash element gamma. So I have to use my %g;
%g<gamma>=[]; %g<gamma>.[].push(5). Is there a simpler syntax?
<sorear> stifynsemons​: I suspect push %g<gamma>, 5 should work
<stifynsemons> push %g<gamma>, 5 doesn't work in 201101 rakudo star
<sorear> (%g<gamma> //= []).push(5) will definitely work
<masak> rakudo​: my %g; push %g<gamme>, 5; say %g.perl
<p6eval> rakudo : OUTPUT�Method '!fill' not found for invocant of
class '' [...]
<moritz_> I'm pretty sure both the sub and method form should work
* masak is surprised the spectests wouldn't pick something like that
up.
* masak submits rakudobug
<masak> stifynsemons++
<moritz_> masak​: there are tests for that. They are just fudged :-)

Seems to work now​:

my %g; push %g<gamme>, 5; say %g.perl
("gamme" => [5]).hash

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Nov 5, 2012

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

@p6rt
Copy link
Author

p6rt commented Nov 14, 2012

From @coke

On Mon Nov 05 14​:45​:00 2012, jnthn@​jnthn.net wrote​:

On Sat Feb 12 13​:15​:58 2011, masak wrote​:

<stifynsemons> Another newbie question​: my %g; %g<gamma>.[].push(5)
doesn't auto-vivify hash element gamma. So I have to use my %g;
%g<gamma>=[]; %g<gamma>.[].push(5). Is there a simpler syntax?
<sorear> stifynsemons​: I suspect push %g<gamma>, 5 should work
<stifynsemons> push %g<gamma>, 5 doesn't work in 201101 rakudo star
<sorear> (%g<gamma> //= []).push(5) will definitely work
<masak> rakudo​: my %g; push %g<gamme>, 5; say %g.perl
<p6eval> rakudo : OUTPUT�Method '!fill' not found for invocant of
class '' [...]
<moritz_> I'm pretty sure both the sub and method form should work
* masak is surprised the spectests wouldn't pick something like that
up.
* masak submits rakudobug
<masak> stifynsemons++
<moritz_> masak​: there are tests for that. They are just fudged :-)

Seems to work now​:

my %g; push %g<gamme>, 5; say %g.perl
("gamme" => [5]).hash

Tagging testneeded.

/jnthn

Found skipped tests in S09-autovivification/autovivification.t, fixed & unfudged them.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Nov 14, 2012

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

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