3 ms·
Most of the "wat" video's complaints also apply to Python. And JavaScript has had many more years of considered design and development than when JQuery or Node
by moron4hire 8y ago
Most of the "wat" video's complaints also apply to Python. And JavaScript has had many more years of considered design and development than when JQuery or Node made it popular.
- orf 8y agoThey really don't.
- londt8 8y agoYou are thinking of something else than python? Python has strong, dynamic type system with little implicit type conversions.
- deathanatos 8y ago> Most of the "wat" video's complaints also apply to Python. No, they don't. All of Wat's complaints against JS, in order of presentation: > [] + [] ; JS: '', Python: [] Python uses + between arrays for concatenation, just like strings, which I think is reasonable. JavaScript does random crap. > [] + {} ; JS: '[object Object]' (that's a string, not an object), Python: TypeError. Again, Python's output here is reasonable, JS's is off the deep-end. > {} + [] ; JS: 0 (the integer) Python: TypeError Again, Python's output here is reasonable. JS appears to demonstrate that + isn't commutative, but that's too rosy a picture: in this case, + actually is commutative, as ({} + []) and ([] + {}) are the same string, but without the parentheses we get 0. Yes, the lack of parentheses changes the value JS emits.¹ > {} + {} ; in Wat: NaN, in Chrome/Node: '[object Object][object Object]', in Python: TypeError Similar to before, Python errors out on the garbage, JS just keep computing ever more insane values. > [longer example, but boils down to "wat"+1 doing something and "wat"-1 doing something else for comedic effect. Python TypeErrors on both of these. Python certainly has its own warts, but they are not as ridiculous as the warts that JS carries around. ¹AIUI, {} + [] is parsed as empty code block, implicit semicolon, unary plus, empty array. The parentheses force the grammar to evaluate the entire thing as an expression, so ({} + []) parses instead as a parenthesized empty object, binary plus, empty array.
- technion 8y agoPurely for reference (since typescript didn't exist when this project started) all four of those terrible JS examples are Typescript errors: " error TS2365: Operator '+' cannot be applied to types x and y"