On 12/27/2010 09:12 PM, Daniel Carrera wrote:
> Thanks. The blacklash "unspace" works.
>
> my @sorted = @names.sort({ %sets{$_} })\
> .sort({ %matches{$_} })\
> .reverse;
>
> Though I'm a bit sad that you need that and you can't just separate methods
> with spaces.
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.
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.
Cheers,
Moritz