I am a bit confused on how I can use libraries in sci, I am embedding sci in a clojurescript app I am setting up sci with init to create a context, I want to be able to use reagent in the context which is already required outside sci, my understanding is I need to use :namespaces is this correct and can I just expose the entire library ? Or do I need to pull in reagent into sci seperately a bit like scittle does ? hoping someone can point me in the right direction.
@oliver.marks My recommendation for reagent is to use the config from here: https://github.com/babashka/sci.configs#reagentreagent
that's great that looks like the info I was missing thanks @borkdude
We should link this from the SCI readme probably
yeah handy I can look at the src and see how they are included now, I see sci/copy-var is the piece ~I likely needed but I can just pull in those configs in my deps now and save myself the trouble 🙂
ok, mentioned it here: https://github.com/babashka/sci#sciconfigs
great, I have managed to add in what I require and it works, I was hoping for honey but getting a sequential? does not exist so need to investigate that one but reitit seemed to work 🙂
(def rf-ns (sci/create-ns 'reitit.frontend nil))
(def rfe-ns (sci/create-ns 'reitit.frontend.easy nil))
(def rss-ns (sci/create-ns 'reitit.coercion.spec nil))
(def sql-ns (sci/create-ns 'honey.sql.core nil))
(def sqlh-ns (sci/create-ns 'honey.sql.helpers nil))
(def sci-ctx
(sci/init
{:namespaces
{'reagent sci-reagent/reagent-namespace
'sql {'format (sci/copy-var sql/format sqlh-ns)}
'sqlh {'select (sci/copy-var sqlh/select sqlh-ns)
'from (sci/copy-var sqlh/from sqlh-ns)
'where (sci/copy-var sqlh/where sqlh-ns)}
'rf {'router (sci/copy-var rf/router rf-ns)}
'rss {'coercion (sci/copy-var rss/coercion rss-ns)}
'rfe {'start! (sci/copy-var rfe/start! rfe-ns)
'href (sci/copy-var rfe/href rfe-ns)}}}))
currently got these added, nice work as usual I was using klipse before but that seems to not work with the latest clojurescripts so was curious if I could use this in its place 🙂sequential? does not exist ?
$ clj -M:cljs -m cljs.main -re node
ClojureScript 1.11.54
cljs.user=> (require '[sci.core :as sci])
nil
cljs.user=> (sci/eval-string "sequential?")
#object[cljs$core$sequential_QMARK_]Need more info. honeysql should work normally
give me a sec may be more info of the edge of the screen, only just encountered it as I included the library 🙂
btw I recommend using the full namespace names in :namespaces. you can provide :aliases for those namespaces as well
thanks for the tips 🙂
the sequential isses was happening inside some honey code but its not related to honey, just evaling sequential? like above is giving me this from sci
#error {:message "Could not resolve symbol: seqential?", :data {:type :sci/error, :line 9, :column 1, :file nil, :phase "analysis"}}
seqential? seems like a typo?
ha your correct nice spot, klipse must have just ignored that else not sure why it did not show up before
clojurescript doesn't fail on typos, but just warns, I think
but SCI is more like JVM Clojure in this regard