https://clojars.org/org.babashka/sci.impl.types -> is there a git repo for that somewhere?
Everything that contain .impl in the name should be considered private and may change at any time
Tell me what you need and we can try to make it a public API
timbre logging: how difficult is it to convert a macro like that:
(defmacro info [& args] `(log! :info :p ~args ~{:?line (fline &form)}))Do something like this:
(defn ^:macro info [&form _ & args]
`(log! :info :p ~args ~{:?line (fline &form)}))
(sci/copy-var info tns)(sci/binding [sci/out *out*] ;; this enables println etc.
(scia/eval-string* ctx-repl code))
when I do this and I eval "(println 343)" I get this error message: "Attempting to call unbound fn: #'clojure.core/print-fn"
It is weird, because I use sci in clojurescript.Use sci/alter-var-root. Binding resets the var too early because async
(sci/alter-var-root sci/print-fn (constantly *print-fn*))I found a missing feature for async compile: async require. A require can also need to load a module asyncronous. This is helpful if there are reagent functions that vizualise something. And they will be in a lazy loaded module 🙂
https://github.com/babashka/sci/blob/master/doc/async.md#lazy-loading-a-namespace might be sort of along the lines of what you're looking for
Thanks @highpressurecarsalesm I am using exactly that. But this only does compilation. I need also a require function that is async 🙂
Yes, I will add require next, issue welcome
@borkdude Thank you so much!!
I guess what it means really, is that there is EITHER a async version, OR a sync version.
Or is it still possible to do sync evals, but unter the hood it is using async require?
Example please
so if I want to load modules via the async loader,
I guess that I have to remove the sync eval from sci
because sync evals will always use the sync require,
and this will not be able to lazy load dependencies.
Can you please give a full standalone example
As code
I think there might be a solution but it depends on your exact example
GitHub issue welcome
I am trying to understand the implications:
So resolve will only depend on the state of the sci-context. So it means if i just call resolve,
it will NOT give me something that is in a lazy namespace.
So what I will need to do, if I resolve something, then there are situations where I might want to require the namespace of the resolve variable first.
And since that resolve is via a promise, I need to await that promise.
So in other words, it is perfectly fine that resolve is always synchronous,
but depending on the usecase I might have to require (async) first.
I think I got this right now 🙂
But I will have to re-think it again, as it is pretty esential when one uses async compilation and requires.
resolve always only resolves the namespaces you have already loaded
that is the same as in Clojure
perfect! then I know how I have to do it! no bugon your side 🙂
@hoertlehner Here is require: https://github.com/babashka/sci/blob/master/doc/async.md#require