Hacker News new | past | comments | ask | show | jobs | submit login

> 3781 - Single quotation mark as digit separator

Hold on a minute. Why is this even a thing? Do people really use HUGE numeric literals and have so much trouble reading them that this is needed?

This just sounds like another parsing nightmare that really should belong in syntax highlighting rather than exist as some obscure language feature.




> Do people really use HUGE numeric literals

Yes. Engineering code uses numeric literals with many digits all the time.

> and have so much trouble reading them that this is needed?

Digit separators make digit omissions/additions much easier to spot. Imagine spending a day trying to track down a "everything explodes" bug, systematically eliminating numerical sources of error one by one, only to find that the problem is a misspecified boundary condition that you didn't catch the first time around because you were counting the number of zeros as opposed to the number of digits.

    c = 3000'000'000 /*  m/s  */
^ I can spot this out of the corner of my eye.

    c = 3000000000   /*  m/s  */
^ This? Not so much.


I prefer this alternative:

  c_millisecs = 50000 * 60 * 1000; // 50,000 minutes


That only works for unit conversions where they're defined as ratios of each other. Nature has physical constants and engineers have environmental and design parameters that can't be written that way unless you constantly change units, which is a bad idea in a language without built-in unit checking (most of them).


I prefer

(1000 * 60 * 60 * 24 * 2) == 2 days




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: