Fork me on GitHub
#sci
<
2020-07-22
>
ikitommi19:07:35

got the dynaload + preload + sci kinda working, just need kaocha to co-operate.

ikitommi19:07:51

looks like this atm:

(ns malli.sci
  (:require #?(:clj  [borkdude.dynaload-clj :refer [dynaload]]
               :cljs [borkdude.dynaload-cljs :refer-macros [dynaload]])))

(defn evaluator [options]
  (let [eval-string* @(dynaload 'sci.core/eval-string* {:default nil})
        init @(dynaload 'sci.core/init {:default nil})
        fork @(dynaload 'sci.core/fork {:default nil})]
    (if (and eval-string* init fork)
      (let [ctx (init options)]
        (fn eval [s] (eval-string* (fork ctx) s))))))

ikitommi19:07:33

the main-ns creates the evaluator with options and re-uses that.

borkdude19:07:49

Been there. I tried to fix the malli unit tests that are ran with koacha, but I ran into issues and decided to just write the library 😉

borkdude19:07:12

E.g. the preloads feature only works with clojure, not with clojurescript