Hacker News new | ask | show | jobs
by master-lincoln 969 days ago
I don't think that's a fair comparison. Here we talk about a tool that fucks up your data once you load it. With javascript there is no such thing. There are some auto type conversions when passing a wrong type into a function that can yield unexpected results. But I would argue this is different as it's an environment for power users only, and there is types at play that should make you as a programmer aware.

E.g.

1 + "hello" = "1hello"

1 - "hello" = NaN

1 comments

JSON parsing treats non-quoted numerals as a Number. That alone can result in some truncation.
Though, in JSON, anything that isn't a number should be quoted?
If the JSON writer is writing according to spec
I don't understand how this is at all a similar issue. If you want a string in JSON, then you must quote it.

https://www.json.org/json-en.html

And if you want a string in Excel you must apostrophe-prefix it. If you think “serial number” == number, telephone number == number, then try to use the number handling, you get problems because “numbers” don’t have leading zeros or spaces or parens or hashes or plus symbols.
I would like to store, then retrieve exactly 1234567890123456789 apples instead of 1.070816993713379 × 2⁶⁰ = 1234567939550609408. Unfortunately due to IEEE-754 conversions I can only do this up to 7-8 digits or so. This is a number, just not one that can be represented as a Number without loss of precision towards the end.
that's more apples than we can fit on the planet. For such special tasks I would think it's ok to need special tools