> If I ever create a programming language, one thing I'd like to try is to promote integer operations to larger types, so there is never overflow.
Are there any languages other than Lisp and Python that have automatic bignum support?
Are there any languages other than Lisp and Python that have automatic bignum support?
Clojure makes a gesture toward it, literals are automatically promoted but the normal operators don't do it:
user=> (+ 1 9223372036854775807) ;; max signed int64
Execution error (ArithmeticException) at user/eval5 (REPL:1).
integer overflow
user=> (+ 1 9223372036854775808) ;; one higher
9223372036854775809N % expr 1 + 9223372036854775807
9223372036854775808
% expr 9223372036854775808 + 1
9223372036854775809However they don't have JS compatibility either (Dart does not round off large integers like JS does), so I forget what the point was.
Dart also (very early) had infinite precision fractions. So if you divided 355 by 113 you didn't get 3 or 3.1415... you got the fraction 355/133 which was an instance of a first class numeric type.
Unfortunately this means your numbers can grow to need arbitrary amounts of storage in loops.