magic
magic copied to clipboard
Integer division
The current implementation of integer division is not type stable.
user> (type (/ 4 2))
System.Int64
user> (type (/ 4 3))
clojure.lang.Ratio
This trips up MAGIC's type flow and until #91 was fixed the compiler would generate invalid bytecode. The current solution (as of 71f0e486524fb65f9371bd16729d51f1cfbfecd1) treats integer division as a var invocation and the return type is Object
. This isn't great, and we should investigate a better approach.
There isn't an obvious solution to this that wouldn't introduce a breaking change to the API. We could potentially introduce other functions that were type stable down the line, but that's another issue.