In the type expression for you put c as a char as a hint to the compiler. When the compiler emits a (static) method for isDigit , it knows that you want the version to accept char (as opposed to possibly the int version). The bytecode is emitted into a function object that implements the O (single Object ) IFn interface (all arguments are marked by default).
In another case, blah-c the byte code must be sent to a function object that implements a non-existent version c (for example, for char ) of the IFn interface. Can there be interfaces for each primitive? Of course, but no. For every possible combination? Impossible due to combinatorial explosion.
You could say, well, why not just fix blah-c in the O interface? This will hit the hint point like the argument of the function, which is to avoid boxing / unboxing, since in order to reconcile the character, the primitive must be placed in the box. The point of allusion to the arguments of a function is not only to avoid reflection. If you want to avoid reflection here, then you do not mark the function argument, but instead take it to the char block in the let block before calling isDigit .
Note in clojure.lang.IFn the listed interfaces (currently) are limited to any number of objects (boxed) and to four combinations of double and long types. The double and long options are provided as optimizations to avoid boxing / unpacking when writing critical performance code on primitives and should be sufficient for most purposes.
A. Webb
source share