Why does Perl 6's string concatenation not like .WHAT?

Viewed 420

I'm puzzled about this bit of code where I apparently can't call the WHAT method in a string concatenation?

my $object = 'Camelia';

say $object;
say $object.WHAT;
say "^name: The object is a " ~ $object.^name;
say "WHAT: The object is a " ~ $object.WHAT;

The output shows that calling ^name works (a metamethod from Metamodel::ClassHOW), but Perl 6 is confused by .WHAT as if there's a precedence issue.

Camelia
(Str)
^name: The object is a Str
Use of uninitialized value of type Str in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed.  in block <unit> at meta_methods.p6 line 7
WHAT: The object is a

My Perl 6:

This is Rakudo version 2015.12-219-gd67cb03 built on MoarVM version 2015.12-29-g8079ca5
implementing Perl 6.c.
2 Answers
Related