how do we spoof a primitive int into a `val foo:(I...
# compiler
j
how do we spoof a primitive int into a
val foo:(Int)->Int
in kotlin-jvm to squash boxing?
e
Function (
(T) -> R
) is generic, so the interface will always box
j
right, so we have to build a java shim and send a SAM through in order to guarantee we start with an int?
e
no need to build one; if you use java.util.function.IntUnaryOperator then it'll be primitive Int
j
java doesn't autobox if you start with a primitive.
if the passed val is inside a java host, presumably tht's enough.