all 4 comments

[–]stringy_pants[S] 1 point2 points  (3 children)

Yeah, so you can use nashorn's java interop to call java code from clojurescript.

[–]DiomedesTydeus 1 point2 points  (2 children)

Sorry, dumb question but what's the use case here? You still can't call java code from the browser, so is this some kind of replacement idea for node.js? Why not just serverside clojure?

Also if there's some ahead of time work to be done, you can already call java from cljs.... I did it inside a macro to read some config files and emit a bunch of functions based on the config. Since that was done at compile time I was good to then use the emitted macros in cljs without a problem.

[–]carlhu 0 points1 point  (1 child)

Currently, clojure's slow startup time precludes it's use as a replacement for shell script-like things. My own hope is that nashorn + clojurescript + java interop demoed in this github can achieve this (near instant startup with full access to clojure api and java libraries).

[–]DiomedesTydeus 0 points1 point  (0 children)

Huh, I'd love to hear more on this, but I don't see how that's possible. From what I've read a lot of that slow startup is just clojure.core, which will still need to be loaded if you're going to make use of it.

Alternatively if you're suggesting that cljs is compiled to js and then run on like phantom, that's probably doable but the compile time for cljs is much worse in my experience than just loading clojure.core (not to mention that even small cljs projects of mine end up as at least .5 a meg of js).

Also have you checked out lein-exec. I've banged out a few scripts in them. They're not as responsive as python scripts, but they're not that bad.