Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Babashka and sci internals @ London Clojurians ...

Babashka and sci internals @ London Clojurians December 2020

Slides from presentation about babashka and sci internals at the London Clojurians Meetup given in December 2020.

Video: https://youtu.be/pgNp4Lk3gf0

REPL session:
https://gist.github.com/borkdude/66a4d844668e12ae1a8277af10d6cc4b

Michiel Borkent

November 30, 2020
Tweet

More Decks by Michiel Borkent

Other Decks in Programming

Transcript

  1. • Native Clojure scripting tool, single binary, no JVM •

    Can be used to replace “the grey areas” of bash • Installable via script, brew (macOS, linux), aur (linux), scoop (Windows) $ time bb '(+ 1 2 3)'
 6
 0.00s user 0.00s system 67% cpu 0.013 total
  2. Small Clojure Interpreter (def f (sci/eval-string "#(+ 1 2 %)"))

    (f 1) ;;=> 4 - Clojure interpreter - Works on JVM / GraalVM / JS - Sandboxing
 - Works in CLJS advanced compiled apps
  3. SCI eval • Why does sci work with GraalVM and

    clojure.core/ eval doesn't? • core eval = compile = generating classes • A native image cannot load new classes at runtime • Sci eval does not generate any new classes.
 Compilation -> interpretation.