I am wondering why ECMA script does not support integers out of the box. Of course I know that there are some kind of integers (there is a good summary in the answer to this question: Difference between floats and ints in Javascript?). But still these are not "real" integers. And the problems with floats as ints are pretty abundant. So why does it not support integers and why was this not fixed with ECMA script 6?
ECMAScript (/ˈɛkməskrɪpt/; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the document ECMA-262.
JavaScript is a general-purpose scripting language that conforms to the ECMAScript specification. The ECMAScript specification is a blueprint for creating a scripting language. JavaScript is an implementation of that blueprint. On the whole, JavaScript implements the ECMAScript specification as described in ECMA-262.
Ecma International (formally European Computer Manufacturers Association) is a non-profit organization that develops standards in computer hardware, communications, and programming languages.
The development of this Standard started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997.
The language was designed and implemented in 10 days, so it was originally a matter of time constraints. From the horses mouth:
Yes, it was there from the start. But bignums were not in the cards. JS had to "look like Java" only less so, be Java's dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JS would have happened.
So double by default, int under the hood, and bitwise ops are 32-bit int (uint if you use >>>). I blame Java.
I wouldn't know why it wasn't on the table for ES2015. To me it seems like a lot of the work as to remove boilerplate, but I'd be guessing. Brendan Eich is pretty active on Twitter, you could probably just ask him. :)
Can't really speak for Harmony, Douglas Crockford, said that they were interested in adding another number type in future editions of ES. However, he also said that adding a new number type was doing violence to the language, that the simplicity of the language was desirable.
https://www.youtube.com/watch?v=V1_Y-KVhZ9Q
He basically starts talking about "Number" from 13:52 to 26:00
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With