5 ms·
The implicit type coercion of JavaScript is terrible, the single-inheritance prototype system is awful, lack of integer types, and undefined.
by cpburns2009 9y ago
The implicit type coercion of JavaScript is terrible, the single-inheritance prototype system is awful, lack of integer types, and undefined.
- azeirah 9y agoNaN is the ultimate horror within JavaScript's type system. Other than that, you're spot-on.
- merb 9y agoor undefined and null. I mean most languages have "problems" with null, but JS basically has two "problems".
- gsnedders 9y agoNaN behaves as it does in any other language with IEEE 754 floats (the behaviour of NaN simply comes from IEEE 754), which is most…?
- dragonwriter 9y ago> NaN behaves as it does in any other language with IEEE 754 floats Yes, but most other languages don't use IEEE 754 binsry floating point as their only numeric type. Or even their primary one.
- cpburns2009 9y agoWhile I dislike NaN and would much rather prefer an exception to be thrown, I can accept NaNs existence because it's at least part of the IEEE 754 standard. It still bugs me that `NaN != NaN`, and JavaScript's type coersions make NaN worse because it seems like they randomly popup.
- ng12 9y agoHow many times have NaN semantics actually broken your code? My guess is never.
- ChrisSD 9y agoSingle inheritance prototype system is actually something I like about js. I'm wondering why you consider it awful?
- cpburns2009 9y agoIt's too ad-hoc and over-complicated to implement common things such as classes and interfaces. In JavaScript you're essentially stuck with stringly typed values and chaining mix-ins together to emulate a class hierarchy. It's also difficult to get instanceof to work as one would expect. The other languages I'm used to all natively support it: Python and Java. Granted, Java is single-inheritance too but you can implement multiple interfaces.
- ChrisSD 9y agoAh yes if you're thinking in terms of classes then that would be frustrating.
- WhatNotAboutism 9y agoEven with the most ubiquitous language in the world using prototypical inheritance, the average (mean) programmer prefers to imagine and express themselves in an inheritance based system. At some point, everyone will have to accept that prototypical approach is fine for some, but less productive over time for the world.