logoalt Hacker News

xelamonster12/09/20242 repliesview on HN

Well what's more readable, .8675309 that is understood to have an implicit zero, or the parser giving up and unexpectedly making it a string? Maybe it's not your preference but I can't see any problem with making this more robust. The trailing one is strange to me but leaving off a leading zero isn't unusual at all for written numbers in my experience.


Replies

The_Colonel12/09/2024

> Well what's more readable, .8675309 that is understood to have an implicit zero

Is it universally understood? I think it's a US / English thing. In my country I've never seen numbers written in this way and many people would not "parse" it mentally as 0.8675309

show 1 reply
404mm12/09/2024

IMO the implicit zero is just as much an issue in regular written form. The period could be overlooked quite easily, but seeing a leading 0, one will know what’s really going on.

How could the parser see it as a string? This is not YAML and JSON5 still requires quotation marks.