kosi-libs / Kaverit

A light multiplatform Kotlin reflection API
MIT License
17 stars 1 forks source link

Support `Any?` #9

Closed mgroth0 closed 6 months ago

mgroth0 commented 7 months ago

I am curious why the extension functions all have an upper bound of Any.

I am exploring possible use cases of this library. I scanned through my code to see where I used typeOf and wanted to play around with if this library could benefit those places. But in those places I have an upper bound of Any?.

I am not quite sure if I have a use for this library but it looks interesting, so I figured I would just ask if this constraint is necessary.

SalomonBrys commented 7 months ago

The goal of this lib is to provide multiplatform reflection without kotlin-reflect on the JVM (mainly because it is too big to be included in an Android app). We therefore use the JVM reflection API that is part of the runtime, which does not support nullable types.

mgroth0 commented 6 months ago

Thank you for the answer.

Is there any collection of small examples, demos, or use cases for this library? I am trying to learn where it fits.

In particular, showing what it offers that kotlin-stdlib does not offer on its own?

romainbsl commented 6 months ago

This library is mostly used by our Dependency Injection library, Kodein. You can find usages here in the bind* files.