https://kotlinlang.org logo
j

josephivie

11/03/2018, 5:57 PM
But the runtime is missing things too, unfortunately. Like polymorphism, which is absolutely critical to what I'm doing right now.
p

pdvrieze

11/05/2018, 4:34 PM
Polymorphism is sort of supported. The problem is serializer discovery. Javascript has no reflection/annotation support yet. It has no Class.forName. Basically the candidate types need to be registered in the context so that they can be found.
j

josephivie

11/05/2018, 8:16 PM
Is that so? I may be able to use it then, which I would honestly prefer… could you point me to how it works exactly then? I researched into it for a bit and all I found was a file in the JVM codebase: https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/jvm/src/main/kotlin/kotlinx/serialization/internal/Polymorphic.kt Which lead me to believe that it only worked on the JVM. My system requires registration too, so maybe I could slide my stuff over into it. Mirror would then become a temporary patch to serialization, which would be better for everyone. I’d prefer to stick to the standard, but I also need something that works within the next couple of months. Required for an upcoming project.
2 Views