Hi, hope you are doing good. :wave: I'm building a...
# android
l
Hi, hope you are doing good. 👋 I'm building an open-source library named Kotools Types that provides explicit types for Kotlin Multiplatform, including Android. For example, the next release will introduce an
EmailAddress
type suggested by the community, compatible with Kotlin and Java. 👀 For this year, our goal is to make it more useful for Android users. So any feedbacks or suggestions are welcomed! 🙏 Thanks for considering and have a nice Kotlin. K
🎉 3
j
Is there any reason you are not using
value class
?
l
@Javier I did for some types like
StrictlyPositiveInt
, but using an inline value class make it barely unusable from Java code, because the compiler replaces the inline value class by its underlying type in the ABI. For example, this is the case for the
PositiveInt.div(StrictlyPositiveInt)
function traduced as
PositiveInt.div-Vo0Sc0k(I)
by the compiler (ABI for this function is available here). Also, declaring a type as an inline value class in a library can be dangerous for consumers: changing the underlying type of an inline value class is an incompatible binary change that can produce errors without changing consumer's code. Types provided by this library will be converted incrementally and in a backward compatible way to regular classes for these reasons.
j
I understand. It is a bit annoying those requirements, I don't know if it is possible to fix this by the Kotlin team somehow. Thanks for the info!
l
@Javier I agree but I don't really know about a possible fix to these restrictions... See the corresponding KEEP proposal for more details on limitations about using inline value classes. As a rule of thumb, I'm considering using inline value classes only in applications rather than libraries. Always happy to help!
j
I love the NotBlankString type you created. Fixes a major petpeeve of mine
l
Happy to know that the
NotBlankString
type is useful for you @John Marshall. 😁 Thank you for your feedback. 🙏 Feel free to join our #kotools-types channel for getting in touch with our community and staying up-to-date with the latest changes of this project. There is more to come... 👀