develooper Front page | perl.perl6.language | Postings from November 2004

Re: Angle quotes and pointy brackets

From:
Juerd
Date:
November 28, 2004 13:39
Subject:
Re: Angle quotes and pointy brackets
Message ID:
20041128213920.GF7312@c4.convolution.nl
John Macdonald skribis 2004-11-28 12:24 (-0500):
> Doesn't that cause ambiguity between:
>      %hash{'foo'}{'bar'}{$foo}[0]{$bar}
> and
>      %hash{'foo'}{'bar'}{$foo}{0}{$bar}
>                               ^ ^	hash instead of subscript

Not really. $hashref[] can't be used and $arrayref{} can't be used. This
means Perl can easily disambiguate.

Only for types that have both [] and {}, there is a problem. When they
are both possible, just define one to have precedence. I'd pick {}.
Exactly the same rule should apply for autovivification: {}.


Juerd



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