Thanks Larry for the answer and the great language.
It is quite ok for me to start alphabetically. I use the funny char to
indicate a particular aspect shared by a bunch of subs operators and
methods.
So I tried:
method term:<brave❤> { "Mel G.".say }
However, that gives me:
Bogus postfix
Thanks,
Theo
Larry Wall schreef op 2016-04-11 22:17:
You have to write it like this:
class Foo {
method ::('❤') { "mem heart".say }
}
my Foo $foo .= new;
$foo.'❤'();
Other than that, only names beginning alphabetically are allowed.
You could work around this on the caller end with a postfix:<❤>, but
that would be an operator, not a method call, so you'd have to write
your postfix:<❤> operator to call the actual method in turn, with
sub postfix:<❤> ($f) { $f.'❤'() }
or so...
Larry
On Sun, Apr 10, 2016 at 03:23:21PM +0200, Theo van den Heuvel wrote:
: Hi perl6 fans,
:
: I can use funny characters in operators or in sub names (using
: term:<...>). However, when I try the same thing with an operator as
: in:
:
: <code>
: class Foo {
: method term:<❤> { "mem heart".say }
: }
:
: my Foo $foo .= new;
: $foo.❤;
: </code>
:
: I get:
: Malformed postfix call
:
: That is unexpected for me, but is this as it should be?
:
: This is Rakudo version 2016.01.1 built on MoarVM version 2016.01
:
:
: Thanks,
:
:
:
:
: --
: Theo van den Heuvel
: Van den Heuvel HLT Consultancy