[OT] Perl woes
Dominic Thoreau
dominic.thoreau at googlemail.com
Wed Jan 28 11:31:37 GMT 2009
2009/1/28 Jonathan Kimmitt <Jonathan.Kimmitt at csr.com>:
>
> The next time I use == instead of eq to compare two strings, I
> will know to expect it will always
> evaluate to true. What other language does this (apart from C,
> which would invariably return false)
Unfortunately, this is perl being helpful. Because you've treated them
like numbers, they must be numbers, and the conversion will be done
automatically.
I feel this makes for easier to understand syntax, where other
languages might overload non-alpha operators.
Eg string concatenation in perl is with the . (dot) operator. In some
other well used languages (Java, for example) the + operator is used,
which is an overloading of the addition operator.
Okay, so Java is already using the . for a member variable/method
separator, where perl uses different syntax,
I'm taking a series of courses in Java (don't shun me for this - it's
part of my OU degree), and I did comment the grumble to the tutor that
it won't let you overload these operators yourself for your own
objects (like, say, C++ will). His comment was that it was a trade
off, sacrificing power in the hope that responsibility was also
lessened, but I'm not sure it was a good design decision.
--
No train here, but still:
The sign says: "Ready to Leave"
Normal service, yes?
More information about the london.pm
mailing list