Hacker News new | ask | show | jobs
by smadge 3020 days ago
First, there are many language who’s default integer type are not fixed bit width. For example Haskell and Python can represent arbitrarily large integers out of the box, limited only by available memory. Second, it is not too difficult to implement these “big integers” in any language. For example, I think java has something called a BigInteger class. Arguably if your “integer” type has fixed but width, it’s categorically not an integer. Third, two of the major underlying theoretical models of computation, Turing machines and Churche’s lambda calculus, allow arbitrary “memory” sizes and arbitrarily large integers. For example the universal Turing machine is imagined as operating over an infinitely long ticker tape. The objection you raise is a theoretical nonissue and I give the author some leeway to make this concept more accessible.
1 comments

I think it's important to know when a theoretical framework can be applied to the full extent and when the real-life situation is actually a subset that behaves differently.

In this case the problem is solvable within the subset presented by the JavaScript language, but there are other cases where applying theory directly to real life constructs without considering the differences can lead to buggy code. For instance floating point numbers come to mind immediately.

I agree that discussions like this are sidetracking the whole point of a good article, but in order to avoid that, I'd use pseudo-code instead of a real language for presenting concepts like this.