3 ms·
> In other languages like C/C++/Java you always struggle with implicit conversions between int and double. Not that I've noticed. Uni-typed operators are esse
by username223 12y ago
> In other languages like C/C++/Java you always struggle with implicit conversions between int and double.
Not that I've noticed. Uni-typed operators are essential in something like Perl, which has lots of implicit conversions (think of the horrible "+" operator in PHP, or "|" in Perl). They're also helpful in something with type inference like Ocaml, though Haskell does okay without them. But with the plentiful explicit type declarations in C-style languages, polymorphic operators are rarely confusing.
- TazeTSchnitzel 12y agoI wouldn't say + in PHP is horrible. If anything, it's more sensible than other languages in that it does only addition, rather than trying to combine addition and concatenation (which is silly, because in a weakly-typed language having 5 + 5 and "5" + "5" work differently makes no sense).