r/Clojure • • May 27 '21

scittle - the Small Clojure Interpreter exposed for usage in script tags.

https://borkdude.github.io/scittle/
77 Upvotes

3 comments sorted by

1

u/kjeeeeh May 28 '21

How does it work?

9

u/Borkdude May 28 '21 edited May 28 '21

SCI (Small Clojure Interpreter) is a Clojure interpreter written in Clojure(Script) itself. Its main job is to evaluate Clojure(Script) from string input. It can be compiled with Closure advanced settings, which means that if you are using it within your application, you can still get a reasonable bundle size.

The trade-off is that the dynamic evaluation may not be as performant as compiled ClojureScript and some advanced Clojure features like deftype or reify are currently not or only partially supported.

Scittle is SCI re-packaged as an application that evaluates <script> tags (marked as application/x-scittle) so it's optimized for this way of using it. You can include it in your page immediately by just including the JavaScript file, without setting up a CLJS project.

1

u/kjeeeeh May 28 '21

Thanks for the explanation!