Is any way to ensure calls to fun stored as a (val...
# announcements
j
Is any way to ensure calls to fun stored as a (val) class field are inlined? For example to pass in a comparator to a heap structure.
d
joelpedraza: Not sure what exactly you want to inline, could you post an example?
k
I think he wants to pass a funtion as a parameter to a class and then inline that in all of the methods of that class.
@joelpedraza No this is not possible, the passed funtion is not known at compile time. The JVM can sometimes inline things like this, so performance shouldn't be that bad.
j
@karelpeeters In my microbenchmarks runtime was 4x slower, but yes I'm essentially looking for a way to inline a field, it would be possible if the fun was statically compiled
d
If it was statically known, you wouldn't need a field 😉