Why? Perhaps you are confusing taste and good sense. The heart is just an example. My intention is for a mathematical symbol and a mathematical meaning. I see nothing wrong with that.

Parrot Raiser schreef op 2016-04-12 01:06:
I hope I never run across code written by someone who thinks this is a
good idea.

On 4/11/16, Theo van den Heuvel <vdheu...@heuvelhlt.nl> wrote:
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



--
Theo van den Heuvel
Van den Heuvel HLT Consultancy
Malden, The Netherlands
 +31 24 3736356
 +31 625492788

Reply via email to