2 ms·
Common Lisp has been like this forever. It makes testing the language much easier, as you don't have to check for overflows when constructing test code. A dyn
by pfdietz 2y ago
Common Lisp has been like this forever. It makes testing the language much easier, as you don't have to check for overflows when constructing test code.
A dynamic language like CL has the added requirement that the integers fit with everything else under a single top type, which in practice limits fixnums to a few bits less than the word size.
- globular-toast 2y agoCL also lets you "switch off" multiple precision if you know you don't need it. You can start with bignums everywhere then declare certain functions to use fixnums after you profile your program to speed it up. Compilers like SBCL can then produce code pretty much as fast as C.
- pfdietz 2y agoYou can write a macro to duplicate a piece of code with different type declarations, and switch between them at entry depending on the types of various values. Code blowup, yes, but you can optimize the common cases without manually duplicating code.