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

Rakudo won't push things to global hash variables, silently dropping them instead #973

Closed
p6rt opened this issue May 5, 2009 · 6 comments

Comments

@p6rt
Copy link

p6rt commented May 5, 2009

Migrated from rt.perl.org#65388 (status was 'rejected')

Searchable as RT65388$

@p6rt
Copy link
Author

p6rt commented May 5, 2009

From @masak

<masak> rakudo​: %*h.push​: $*IN.slurp.join.comb.map(-> $k {$k=>1}); say %*h.perl
<p6eval> rakudo 4d7fe5​: OUTPUT«{}␤»
<masak> I would expect something non-empty.
<masak> rakudo​: %*h.push​: 1 => 2; %*h.perl.say
<p6eval> rakudo 4d7fe5​: OUTPUT«{}␤»

@p6rt
Copy link
Author

p6rt commented May 5, 2009

From @perlpilot

On Tue May 05 00​:13​:45 2009, masak wrote​:

<masak> rakudo​: %*h.push​: $*IN.slurp.join.comb.map(-> $k {$k=>1}); say
%*h.perl
<p6eval> rakudo 4d7fe5​: OUTPUT«{}␤»
<masak> I would expect something non-empty.
<masak> rakudo​: %*h.push​: 1 => 2; %*h.perl.say
<p6eval> rakudo 4d7fe5​: OUTPUT«{}␤»

Initializing the global hash seems to help.

< PerlJam> rakudo​: %*h = (); %*h.push​: 1 => 2; %*h.perl.say
< p6eval> rakudo 8009ac​: OUTPUT«{"1" => 2}␤»

Even if you initialize it badly​:

< PerlJam> rakudo​: eval "%*h = 1"; %*h.perl.say; %*h.push​: 1=>2;
%*h.perl.say;
< p6eval> rakudo 8009ac​: OUTPUT«{}␤{"1" => 2}␤»

(the eval is there because %*h = 1; would normally die)

@p6rt
Copy link
Author

p6rt commented May 5, 2009

@perlpilot - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 11, 2009

From @kyleha

On Tue May 05 00​:13​:45 2009, masak wrote​:

<masak> rakudo​: %*h.push​: 1 => 2; %*h.perl.say
<p6eval> rakudo 4d7fe5​: OUTPUT«{}␤»

In Rakudo e5562c90e4bc421b562f68f8fa1ddc1e776eab12, this does something
different.

$ ./perl6 -e '%*h.push​: 1 => 2; %*h.perl.say'
Method 'push' not found for invocant of class 'Failure'

After a brief conversation on #perl6, I think this needs a spec.

http://irclog.perlgeek.de/perl6/2009-10-11#i_1592341

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

From @pmichaud

S03 says​:

"It is illegal to assign or bind a dynamic variable that does not
already exist. It will not be created in GLOBAL (or PROCESS)
automatically, nor is it created in any lexical scope. Instead, you must
assign directly using the package name to get that to work​:

  GLOBAL​::<$mynewvar> = $val;"

Based on this, it's illegal to attempt to .push to an undeclared %*h;
indeed, the error arises from trying to call .push on a Failure object.

Rejecting ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

@pmichaud - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Jun 25, 2012
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