https://kotlinlang.org logo
Title
p

pavi2410

07/12/2019, 6:50 PM
Any lightweight Kotlin interpreter in the market?
🇳🇴 1
j

josh

07/12/2019, 6:51 PM
Most Kotlin developers under 150 pounds should qualify. (just kidding!) 😉
😆 3
😢 1
p

pavi2410

07/12/2019, 6:58 PM
Took time but I understood 😂
😂 2
j

josh

07/12/2019, 7:00 PM
My friend saw this and said "Kotlin interpreters are in short supply, so they must be slim pickings!" 😛
p

pavi2410

07/12/2019, 7:20 PM
Jokes apart, I am looking for a Kotlin "Repl" 😂 like Beanshell.
j

josh

07/12/2019, 7:31 PM
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

pavi2410

07/12/2019, 7:38 PM
I want the Repl to be embeddable as a library
for Android
j

josh

07/12/2019, 7:41 PM
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

karelpeeters

07/12/2019, 8:20 PM
I'd assume all of the Kotlin #scripting just works on Android as well?
j

josh

07/12/2019, 8:27 PM
g

gildor

07/13/2019, 9:03 AM
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

raulraja

07/13/2019, 11:31 AM
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

pavi2410

07/13/2019, 3:49 PM
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

raulraja

07/13/2019, 10:11 PM
@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