H.Merijn Brand skribis 2006-12-22 16:03 (+0100):
> > In Perl6:
> > print sqrt(9) + 7; # Prints 10.
> > print sqrt (9) + 7; # Prints 4.
> I know something was going to change, but to make a language unusable?
The parens for sqrt(9) are a post-circum-fix operator in Perl6.
Postcircumfix operators cannot be preceded by whitespace.
I think that's pretty usable. Not because it's what everyone has always
been used to, but because it is consistent within this language.
A postcircumfix operator may also be used with method-like syntax, using
a dot:
print sqrt.(9) + 7; # Prints 10.
And if you really must use whitespace (for example, a newline
character), you can explicitly escape it, but only if you use the
dot-notation:
print sqrt\
.(9) + 7; # Prints 10.
print sqrt\ .(9) + 7; # Prints 10.
This syntax is ugly and should be used in emergencies only.
> Well, if above is true, perl6 has lost me too. Forever.
Or you could write a grammar that suits your programming style better.
But the following set of wishes clashes heavily:
- () can be used for grouping (to override precedence)
- () can be used to enclose subroutine arguments
- subroutines can also be used without ()
The solution is to use heuristics, that cause inconsistencies all over
the language. We'd all love that, right? :)
> A function should in my vision *always* be separated from it's paren with a
> space.
My vision is that it should never, but let's not discuss this. Won't get
any of us anyware.
You are right that Perl 6 is less friendly (you could say hostile) for
people with different whitespace styles than Perl 5 was.
I personally think the syntax with a dot is very nice and clear. But if
you insist on using whitespace, not a dot, the default Perl 6 is
certainly hateful for you.
--
korajn salutojn,
juerd waalboer: perl hacker <[email protected]> <http://juerd.nl/sig>
convolution: ict solutions and consultancy <[email protected]>
Ik vertrouw stemcomputers niet.
Zie <http://www.wijvertrouwenstemcomputersniet.nl/>.