-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Chasm looks like an incredibly cool project, and the possibilities are countless.
The most natural extension to WASI support would be running containerized Kotlin/WasmWasi using Chasm, with access to specific packages from the host, similarly to KotlinScript (.kts
).
Therefore, my suggestion—allow to simply reference functions to expose them to the Chasm container, for example:
fun Foo.myHostApi(): Bar
instance.expose(Foo::myHostApi)
Or even entire packages:
instance.exposePackage("com.example.gameEngine")
My optimal API for this would be to have some kind of @ChasmExposed
annotation:
instance.exposeAnnotated<ChasmExposed>()
Reflection data (that is not available in runtime due to multiplatform limitations) for the latter two could be made up for using some kind of compiler plugin similarly to KotlinX Serialization.
But of course, the initial request is to simply be able to expose functions automagically.
The ultimate extension to this would be to somehow support (an improved version of) the KotlinScript API, but this is a separate issue entirely that'll likely need to be developed in collaboration with the Kotlin Foundation.