You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, great job :) A multiplatform reflection library is a great addition to the ecosystem :)
We're looking at migrating a library to multiplatform in the future, but we rely heavily on reflection and type logic, so I'm curious to see how far Kaverit can help us.
also gives kotlin.Any, which, according to the docs should be kotlin.Nothing. This is because the variance of type T is in in Comparable<in T>.
Combining types
Aside from that, I'd also be interested in a way to "add" multiple types together and do some logic, finding the lowest common parent between two types.
Something like:
but a bit more efficient maybe, and it should be able to calculate lowestCommonType(generic<List<Int>>(), generic<List<Double>>()) correctly. This might also require some variance/bound checks on generics. Specifically, I'd be interested in calculating the combinations of types such as the highlighting of the IDE can do like this:
interfaceA : Comparable<Double>
interfaceB : Comparable<Int>
interfaceC : Comparable<Number>
interfaceD : List<Double>
interfaceE : List<Number>
funfunction(a:A, b:B, c:C, d:D, e:E) {
val list1 =listOf(a, c) // inferred as List<Comparable<Double>>val list2 =listOf(a, b) // inferred as List<Comparable<Nothing>>val list3 =listOf(d, e) // inferred as List<List<Number>>
}
The text was updated successfully, but these errors were encountered:
We have started considering your request. However, this may be challenging due to the non-JVM platform, which has limited APIs compared to JVM.
Currently, this library fulfills its original purpose as it is the core of our dependency injection library, Kodein.
We need to evaluate how the typeOf function has evolved to determine if new capabilities have been added. Unfortunately, we don't have the bandwidth at the moment. Feel free to investigate if you have the time.
First of all, great job :) A multiplatform reflection library is a great addition to the ecosystem :)
We're looking at migrating a library to multiplatform in the future, but we rely heavily on reflection and type logic, so I'm curious to see how far Kaverit can help us.
I do have a couple suggestions and concerns.
Variance and
*
notations:I noticed
TypeToken.getGenericParameters()
fills in*
parameters of generics withAny
no matter the variance or supertype:is given as
kotlin.Any
. In this case,*
meansAny?
, but I see you don't support nullability on purpose, so that's fine.However, for
it returns
kotlin.Any
too. I'd expect there to be a way to know that*
meansNumber
here.Finally,
also gives
kotlin.Any
, which, according to the docs should bekotlin.Nothing
. This is because the variance of typeT
isin
inComparable<in T>
.Combining types
Aside from that, I'd also be interested in a way to "add" multiple types together and do some logic, finding the lowest common parent between two types.
Something like:
but a bit more efficient maybe, and it should be able to calculate
lowestCommonType(generic<List<Int>>(), generic<List<Double>>())
correctly. This might also require some variance/bound checks on generics. Specifically, I'd be interested in calculating the combinations of types such as the highlighting of the IDE can do like this:The text was updated successfully, but these errors were encountered: