develooper Front page | perl.perl6.language | Postings from June 2005

Re: Transparent / Opaque references

Thread Previous | Thread Next
June 2, 2005 13:46
Re: Transparent / Opaque references
Message ID:
"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

(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

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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About