3 ms·
Which would be fine if I only ever used "+" with literals. But normally, I write things like x + y where x and y are values I got from who knows where. Javasc
by Chattered 12y ago
Which would be fine if I only ever used "+" with literals. But normally, I write things like
x + y
where x and y are values I got from who knows where. Javascript shouldn't pretend to figure out what I mean by this, because in many cases, I'm talking gibberish, and all I have is a bug.
I'd rather not talk about this stuff in terms of "types." It's about assertions, and Python makes them early and throws the exceptions early. It's a defensive practice that you can emulate in any language, and your assertions can be much richer than anything that is typically thought of as a type.
- rectangletangle 12y agoI'm definitely a fan of Python's strategy. It's much better at detecting bugs early and often. That, and there's a distinction in Python between identity and equality, with the `is` and `==` operators respectively.
- thaumasiotes 12y agoFrankly, I think Perl has the best approach to this specific problem. We all want to do some string concatenation. We all want to render some non-string values as strings sometimes. So: 1 + 0 = 1 1 . 0 = 10 Just stop using + to concatenate strings.