3 ms·
Do you not find the fact the JavaScript has no concept of integers and treats everything as floating point, as a valid point to it being a mess with numbers? S
by axaxs 7y ago
Do you not find the fact the JavaScript has no concept of integers and treats everything as floating point, as a valid point to it being a mess with numbers?
Sure, you can make it work. But I think it's a fair criticism when compared to just about any other language.
- jgtrosh 7y agoConversely, do you find that this criticism applies to Lua?
- deleted 7y ago[deleted]
- OskarS 7y agoAs a person who spends his days writing Lua, it absolutely applies.
- axaxs 7y agoAbsolutely. I don't particularly like either language much as a self admitted language snob, but I have to realize their successes and try to remain rather objective in my statements. Subjectively, I think that python does numbers best for a scripting language.
- samatman 7y agoI would say ever so slightly less. Lua has the identical problem to JS, in that you get 53 bits of precision (now 64 with Lua >= 5.3). However, Lua has operator overloading, so it's practical to import an infinite-precision integer library, define the operators, and then use ordinary arithmetic from there, with correct results. I would prefer a proper built-in numeric tower, but I'm in the minority there; Lua is a minimalist language and generally doesn't add things to the core which can be written as extensions.
- chrisseaton 7y agoSeems like the opposite of a 'mess'? Maybe it's too minimal and limited. But having just one of a thing seems hard to characterise as being 'messy'.
- dgb23 7y agoYou can force JS to treat a Number type as an integer. It is uncommon and a bit more verbose. https://en.wikipedia.org/wiki/Asm.js https://en.wikipedia.org/wiki/Asm.js I agree though. Dealing with arithmetic (or with Dates) in JS can be painful.