Any lightweight Kotlin interpreter in the market?
# announcements
p
Any lightweight Kotlin interpreter in the market?
🚫 1
j
Most Kotlin developers under 150 pounds should qualify. (just kidding!) πŸ˜‰
😒 1
πŸ˜† 3
p
Took time but I understood πŸ˜‚
πŸ˜‚ 2
j
My friend saw this and said "Kotlin interpreters are in short supply, so they must be slim pickings!" πŸ˜›
p
Jokes apart, I am looking for a Kotlin "Repl" πŸ˜‚ like Beanshell.
j
That's cool! I don't know of any that are distincly "lightweight" because I don't know how to measure that, but there is a way to do REPL here: https://kotlinlang.org/docs/tutorials/quick-run.html#repl
p
I want the Repl to be embeddable as a library
for Android
j
Interesting! I don't know of any that can be embedded in Android (probably because of remote code execution concerns), but if you find one, let us know! πŸ™‚
k
I'd assume all of the Kotlin #scripting just works on Android as well?
j
πŸ‘Œ 1
g
I would clearly distinguish between Kotlin scripting and interpreter. Kotlin Scripting it's API on top of compiler, every code passed to repl, script engine etc will be compiled by full-blown Kotlin compiler (embedded version of it), so it's quite big dependency and not so fast (but fast enough for Repl usage) And no, Kotlin interpreter doesn't exist (yet?) So I wouldn't concider it as "lightweight" for now, especially for mobile. Depends on your use case for sure
r
You can run kotlinc with a classpath and have a repl in the command line where you can interact with your module
The REPL experience is not great though compared to other langs out there
p
I am looking for something like this https://github.com/beanshell/beanshell
But for Kotlin
to use on Android
If I do not find one, I shall give a try to make one myself.
r
@pavi2410 Kotlin ships with an implementation javax.script.ScriptEngine in case you are already dependent on that for beanshell https://github.com/JetBrains/kotlin/tree/master/libraries/examples/kotlin-jsr223-local-example