jank-lang / jank

The native Clojure dialect hosted on LLVM
https://jank-lang.org
Mozilla Public License 2.0
1.69k stars 50 forks source link

Unboxed primitive fn signatures #47

Open jeaye opened 1 year ago

jeaye commented 1 year ago

Clojure supports unboxed signatures for fns with up to 4 params. jank can do the same thing, but it comes in two steps:

  1. We support type hints on fns and generate the appropriate primitive version
  2. When we already have the type/box info for each param, we can generate code to invoke accordingly

Right now, jank tracks boxing info, but not type info. This may be required, if we support unboxed things which aren't numbers. I'm not yet sure if we will.

Alex Miller covers an example of this here: https://youtu.be/s_xjnXB994w?t=2529