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

Pair.map leaves $_ undefined in the codeblock parameter in Rakudo #622

Closed
p6rt opened this issue Jan 14, 2009 · 8 comments
Closed

Pair.map leaves $_ undefined in the codeblock parameter in Rakudo #622

p6rt opened this issue Jan 14, 2009 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Jan 14, 2009

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

Searchable as RT62332$

@p6rt
Copy link
Author

p6rt commented Jan 14, 2009

From @masak

<masak> rakudo​: my $x = :a<5>; say $x.map({.key => .value + 1}).perl
<p6eval> rakudo 35518​: OUTPUT«Method 'key' not found for invocant of
class 'Failure' [...]
<masak> moritz_​: would you expect map to work on a pair?
<moritz_> masak​: since we support it on Any, yes
<masak> so the above is surprising.
<moritz_> rakudo​: say 1.map({ say 2*$_ });
<p6eval> rakudo 35518​: OUTPUT«2␤1␤»
<moritz_> not just that...
<moritz_> but also a...
<moritz_> bug
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Jan 15, 2009

From @masak

Andy Bach writes (>)​:

Hmm​:
./perl6 -e 'my $x = :a<5>; say $x.map({.key, .value + 1}).perl'
["a", 6]

./perl6 -e 'my $x = :a<5>; say $x.map({.key => .value + 1}).perl'
Method 'key' not found for invocant of class 'Failure'

so it's the 'supercomma' that's troubled?

Seems like it. The pair composer likely imposes hash block parsing on
the surrounding block. I'm not savvy enough about hash block parsing
rules to know if this is correct or not.

@p6rt
Copy link
Author

p6rt commented Jan 15, 2009

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

@p6rt
Copy link
Author

p6rt commented Jul 17, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in b/t/spec/S32-list/map.t

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

From @bbkr

[12​:28] <p6eval> star 2010.07​: OUTPUT«===SORRY!===␤Confused at line 22,
near "rakudo​: my"␤»
[12​:28] <bbkr> star​: my $x = :a<5>; say $x.map({.key => .value + 1}).perl
[12​:28] <masak> bbkr​: rakudo doesn't do labels yet.
[12​:28] <p6eval> star 2010.07​: OUTPUT«Method 'key' not found for
invocant of class ''␤ in main program body at line 22​:/tmp/_GZCINSyyx␤»
[12​:28] <bbkr> masak​: thanks
[12​:29] <masak> star​: my $x = :a<5>; say $x.WHAT
[12​:29] <p6eval> star 2010.07​: OUTPUT«Pair()␤»
[12​:30] <masak> star​: my $x = :a<5>; $x.map( { say .perl } )
[12​:30] <p6eval> star 2010.07​: ( no output )
[12​:30] <masak> star​: my $x = :a<5>; say $x.map( { say .perl } ).elems
[12​:31] <p6eval> star 2010.07​: OUTPUT«"a" => "5"␤1␤»
[12​:31] <masak> huh -- we have sink context now? :)
[12​:31] <masak> star​: my $x = :a<5>; say $x.map( { say .key } ).elems
[12​:31] <p6eval> star 2010.07​: OUTPUT«a␤1␤»
[12​:31] <masak> star​: my $x = :a<5>; say $x.map({; .key => .value + 1}).perl
[12​:31] <p6eval> star 2010.07​: OUTPUT«("a" => 6)␤»
[12​:32] <masak> bbkr​: there you go. needs the ;

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

From @bbkr

[12​:33] <masak> bbkr​: moritz_++ informs me in meatspace that he coded up
such an error message :)
[12​:34] <masak> rakudo​: my $x = :a<5>; say $x.map({ .key => .value +
1}).perl
[12​:34] <p6eval> rakudo 966797​: OUTPUT«Method 'key' not found for
invocant of class ''␤ in main program body at line 22​:/tmp/OGubzkL0kd␤»
[12​:34] <moritz_> 65eb876cb4284a3d96c5910e21a2153ce55c5535
[12​:34] <masak> ah. that explains this error message :)
[12​:34] <masak> still, moritz_++
[12​:34] <masak> it's trying to do .key on $_ with an Any() in it.
[12​:34] <moritz_> right
[12​:34] <moritz_> I can't fix that by another multi :-)

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

From @pmichaud

Test exists in S32-list/map.t and Rakudo passes it, so marking ticket as
resolved.

Pm

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

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

@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