Hi! Had anyone ever tried to use Scala interop in ...
# announcements
m
Hi! Had anyone ever tried to use Scala interop in Kotlin (like using scala classes, implementing interfaces, scala collections etc)? I know sounds ugly, but… 🙂
t
Yes, I've tried it with the Scala interfaces in Apache Spark and it was not fun. Better to use Java interfaces if they exist for whatever library you are using
n
what is your context? your use-case?
m
Thanks, I an now trying to bring Kotlin to our codebase so need to create some “bridge” to our bootstrap (written totally in Scala). The idea is that other devs can start new microservices in Kotlin using my bridge so won’t use scala directly. We are working on it for a couple of days and it is much more pain than we could imagine
o
If it’s microservice, why do you need any specific interop other that http://12factors.net/?
m
It is a good question. actually it is not obligatory. We are using gRPC for communications but there are some plugins which helps us generating interfaces for communication and skeletons. But the code they produce is Scala. I mean that other devs won’t write new services in Kotlin if we do not provide similar plugins for Kotlin. The thing we try to do is to reuse some similar parts of Scala generators for Kotlin but due to awful interop it would be really better to write it in Kotlin from scratch.
o
n
it would be really better to write it in Kotlin from scratch
that’s what i would advise etiher create the code in kotlin from scratch or create a kotlin generator otherwise, you’re bound to run into issues that will decrease the credibility of kotlin only because of bad interop with scala
g
Also, don't forget that you can use Java generation, for things like grpc you can find many solutions