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

Re: ./method <defunct>

Thread Previous | Thread Next
From:
Darren Duncan
Date:
June 18, 2005 21:02
Subject:
Re: ./method <defunct>
Message ID:
p06210201beda992877b2@[192.168.1.101]
At 1:54 AM +0200 6/19/05, Juerd wrote:
>Except for attributes, which play a different game: the colon comes
>*instead* of the dot as the twigil, while the accessor method gets : in
>front of its name. If I recall correctly, the syntax is very misleading
>in that it is NOT part of the name.

I would argue that the same rule applies to attributes and methods 
alike; privates of both have ':' as part of their name, and *every* 
attribute or method reference, public or private, has a '.'.  No 
"instead" here.

So if you just factor out the ':' as being part of a private thing's 
name, then all other discussions for syntax can treat public and 
private the same way.

This goes for both explicit invocant forms like $obj.attr or 
$obj.meth and implicit forms like $.attr or $.meth, where in all 
cases 'attr' or 'meth' may or may not contain a leading ':', but it 
doesn't matter for the main discussion, except that ':' can't be used 
in the trailing edge of the operator.

Its much more consistent that way.

>     $.bar      $.:bar      # I wouldn't mind if $:bar were an *abbreviation*

I agree and would accept $:bar *if* it were officially an 
abbreviation, as you suggest, just like one can omit the '.' on 
things like $foo.[0].{'bar'}; however, the full/longer form should 
always be valid syntax.

-- Darren Duncan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About