This proposal is to allow metadata on functions to prevent a fully dynamic var deref to be used whenever the function is called.
When the function is invoked, JVM "invokevirtual" instruction will be used, which is faster than the current implementation (var deref + IFn cast + invokinterface) and has less restrictions (no need to predefine interfaces to match the function parameters). The JVM is generally able to compile such invokevirtual instructions into extremely efficient code - effectively as fast as pure Java.
This is intended to pave the way to better support for statically compiled, high performance code. In particular, it allow:
Supporting arbitrary JVM primitives (float, int, byte, char etc.) as well as just double/long.
Supporting typed return values e.g. "String". This could eliminate many casts and type checks.
Supporting typed reference arguments (e.g. String).
(defn ^:static foo ^int
(+ (count a) (Integer/parseInt b)))
Existing code / semantics should not be affected