On Mon, Dec 27, 2010 at 10:00 PM, Moritz Lenz <mor...@faui2k3.org> wrote:

> But there's a good reason: .method is a term on its own, and actually
> means $_.method. So if you write  @names.foo .bar, that's two terms in a
> row.
>

That is indeed a good reason. I think I knew about it but forgot. That now
the $_ variable is a little less magical and a little more predictable.
Instead of writing just "print" you write ".print" which makes it clear that
print is acting on $_.


You could argue that that's always a syntax error, and we could
> special-case it after a method, but I think it's a bad idea. Firstly
> it's an exception that makes it harder to learn the language, and
> secondly disallowing two terms in a row is what enables predictive
> parsing, and is very important for getting sensible syntax error messages.
>


I'm not a big fan of special cases. As you said, they make the language
harder to learn. I would add that it makes it harder to predict what a piece
of code is going to do. One thing I want from a programing language is to
predict what it's going to do.

Cheers,
Daniel.
-- 
No trees were destroyed in the generation of this email, but a large number
of electrons were severely inconvenienced.

Reply via email to