<@U0B85AN68> I'm looking into the cases to actuall...
# arrow
@Eugenio I'm looking into the cases to actually support generic type args. I still don't see how we can support this without a runtime lookup. Provided I have this:
Copy code
@implicit fun provideIntList(): List<Int> = listOf(1,2,3)
inline fun <reified A> la(@implicit l: List<A>): List<A> = l
val lint: List<Int> = <http://target.la|target.la><Int>()
My understanding is that the annotation processor has no visibility as to where
is. You mentioned that:
Copy code
...what you would want is to generate one function for every generic provider, and then change the bytecode (at call site) to swap every generic invocation with the actual specific function
the annotation processor can do all the analysis and code generation, but there has to be another step to swap those invocations in the bytecode.
In that case even if we were able to replace the invocations in the bytecode some of those invocations are actually of this form:
Copy code
inline fun <reified A> addToList(a: A, @implicit l: List<A>): List<A> = l + a
And those methods need to work for any
provided there is a
implicit provided, in this case
. Meaning the compiler should bail when
is declared but compile when
is declared because
is available implicitly. Scala uses the typechecking phase to do implicit resolution AFAIK so even with bytecode injection we would not be able to support this at compile time? If that is the case only runtime lookups are the option to support generic args which are most of the cases in Kategory. Thoughts?