Skip to content

Messing with JShell Espresso #2

@joinr

Description

@joinr

Actually got a semi-functioning REPL using espresso-jshell when adding an uberjar with clojure dependencies to the class path. This is more a cumbersome experiment in how impractical the existing clojure setup would be with truffle-on-java via espresso, and delegates all of the runtime evaluation to jshell-espresso. It seems to work in principle; we are able to import clojure.main and invoke a repl, except things fall apart after that (I believe due to IO problems with std-in and friends; perhaps jshell doesn't like the REPL hijacking things).

Since we are effectively just offloading the work to espresso, effectively bundling our own JVM via native-image (80mb + 5mb for clojure), this is a suboptimal solution. Things load within a few seconds, some of which is due to the early poor performing state of espresso (expected to improve vastly though).

Some portions of the clojure runtime are amenable to lifting out into native AOT compilation (e.g. the reader), but the prevalence of reflection for compilation and evaluation (and class loading) presents a tall order. Things are fairly tightly woven, so isolating the parts that can be purely AOT'd is a tall order. Still, we have at least one means of introducing potentially efficient runtime clojure scripting with access to eval and friends, although the current file size and startup time is far worse than interpreters like babashka.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions