logoalt Hacker News

saghmtoday at 4:37 AM2 repliesview on HN

> Sympathy for the machine only exists in developers. They will happily explain why integer overflows need to happen. The average human response to integer overflows is “WTF, that’s not how numbers work”. We have BigInt and 99% of the time the WTF response is the correct one.

Forget sympathy for the machine; the real reason we need programming languages that prevent issues because we should have sympathy for the poor humans who are incapable of reasoning about anything but the simplest code without hitting the limits of their hardware. I'd argue that for virtually all humans (whether developers or otherwise), the brain is like the world's worst runtime for code imaginable. The maximum memory is absurdly low (how many variables can you really remember at once?) and prone to corruption that makes C look like a heaven-sent solution to undefined behavior (how many parents of multiple children do you know who never accidentally call kids the wrong name? my average length between calling one of my cats by the name of the other is like, a day at most), and the speed is laughable (time for a single division operation is on the order of entire seconds).

The widest integers in the world will not stop us from writing buggy code, and I think we have bigger fish to fry than BigInts


Replies

renoxtoday at 8:11 AM

This part is very bad, 99% of the time if you overflow a 64 bit variable it is because you did the wrong computation, not because you need BigInts..

pmontratoday at 4:57 AM

About your question

> how many variables can you really remember at once?

and our brain being a bad runtime for programming:

I started programming on a Sinclair ZX81 with 1 kB of RAM. I wrote my program on paper, reasoned about it by tracing variables on paper and eventually I typed in the program on the keyboard and run it. That was much better than typing line numbers and BASIC commands directly into the REPL.

Of course I had bugs and the actual values of those variables surprised me. They still do but I have a much wider view on the software now, usually a couple of 100x50 columns of code side by side. The ability to follow the values is not much better, but values are seldom the important matter, at least in web development, backend and frontend. It's more about the control flow and the data structure. That's more similar to the organizational issues of many other human activities. This goes there, that goes into that other place. My old 1 kB computer programs had little space for organization.