Skip to end of metadata
Go to start of metadata

Problem

Rich numeric types (longs, bigints, and ratios at least) are good. It would be nice if ClojureScript could enable programming with them without too much pain, in spite of the fact that most JS runtimes only support doubles. Performance is a major concern.

 

Design Questions

What type do clojure longs compile to?

They could compile to floats to give default performance, closure longs for the closest equivalence, or closure bigints for a simpler cljs-side design.

If JVM longs are only used for performance, and closure longs aren't native, is there any reason to use them?

How should the arithmetic functions be implemented?

If nothing else it could be a separate library, with a macro for including numeric literals.

The arithmetic functions are I think currently inlined; to extend them to all the numeric types we would have to at least also inline a type check on the arguments, and call out to a proper function if the arguments aren't all numbers.

Labels: