I'm wondering what's the thoughts about making a K...
# serialization
j
I'm wondering what's the thoughts about making a Kotlin Library which uses the kotlin serialization compiler plugin? Or should I try to avoid using
@Serializable
for libraries?
d
If Ktor can do it then anyone can
j
I do not see that they are using it. https://github.com/ktorio/ktor/search?p=1&q=Serializable Only gives results for their unit testing
d
Why wouldn’t you? I have a library, and the library can save its “storage” in a file and load from that file. Some sort of a file cache.
j
I'm just unsure how compiler plugins fully work and how it will effect users of this library. Example if some users using the library are using one version of kotlinx.serialization while the library is using another version. Maybe all this doesn't matter at all?
r
That doesn't matter for compiler plugins, they only affect code in the project they are added to. Of course, that's still an issue with the runtime, but that's expected. You could use Kotlinx serialization internally and hide it with
serialize(data: MyData): String
style methods just fine.
👍 1
👍🏼 1