|
|
|
|
|
by dumael
3919 days ago
|
|
I'll freely admit I'm not a fan of dynamic languages (mostly due to hacking the Erlang HiPE compiler) and in a previous life I was a Haskell guy. So I'm a fan of strict typing. > The unreasonable behavior is giving integers as strings. That I can agree with. But in that case this notion of reusing '+' as string concatenation but '-' is coercing strings to integers is utterly bizarre. I'm afraid to ask what '*' does (string replication?) and '/' "space magic"? |
|
I'm personally against type coercion - but I also understand how it functions (and why it functions). I disagree with the "why" but as long as I understand the "how" I can avoid gotchas like string coercion. :)
Multiplication ( * ) and division ( / ) coerce to integers. Only + is used for strings, particularly concatenation. Personally I'm a fan of & being used for string concatenation and can't think offhand why not to use it, other than slight possibility of confusion over &&. However I'm not aware of a language that uses it.