On Sun Dec 07 04:33:27 2008, masak wrote: > Moritz (>), Carl (>>): > >> Rakudo r33577 responds strangely to the following program: > >> > >> $ perl6 -e 'my $locator = method { .<here> }; my %h = { here => "foo" > >> }; say %h.$locator' > >> get_pmc_keyed() not implemented in class 'Undef' > >> [...] > >> > >> I'd expect it to output "foo". > > > > Is it actually specified that an anonymous method should receive the > > invocant as $_? if yes, where? > > Yes, here: > > <http://perlcabal.org/syn/S12.html#line_279> > That doesn't actually say your example should work. It mentions:
$locator = { .<here> } $obj.$locator # $obj<here> Which is a closure, not an anonymous method, and when it does mention the anonymous method syntax, it uses self. Plus I don't see anywhere else in S12 that it states that the invocant is in $_ by default for a method. Asked TimToady to confirm either way, then will either implement that if it's meant to be implemented, or reject the ticket (and remove the incorrect test) otherwise. Thanks, Jonathan