"TSa (Thomas Sandla▀)" skribis 2005-06-02 22:22 (+0200):
> The only thing that is a bit unclear to me is if the dot is part of the
> operator name---like a sigil---or purely syntactical. A method is e.g.
> also not defined with the dot:
> class Blahh
> {
>    method .example ( $non_invocant ) {...}
> }

Good question.

Attributes are declared with a dot:

    has $.foo;

And the colon in private method names appears to be part of the name:

    method :foo { ... }

However, while $:foo corresponds to :foo, $.foo does so to foo, not
.foo

(I personally hate the weird thing with private attributes and methods.)

Every postcircumfix operator we have can be used with and without the
dot, and it's unclear if the dot is part of the name.

While with reduce we include the dot

    [.{}]

the operator itself is declared without:
    
    &postcircumfix:<{ }>

Hm, back to methods: in Perl 5 I used to make the mistake of writing
"sub .foo" when I meant what we now call "method foo". 

If we allow "sub .foo", "sub :foo" comes naturally, and another
asymmetry is gone.

It would also allow "multi sub" and "multi method" to simply become
"multi". 

This leaves submethods, and perhaps they just need a third character,
that joins . and :. I have no idea what character would be useful, but
assuming >, it would also give $>foo, which would be to attributes what
submethods are to methods.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to