Hi. I have an issue evaling a sci form in malil, thought it might be relevant to ask here as well: https://clojurians.slack.com/archives/CLDK6MFMK/p1663500554062529
if something is unresolved in SCI then you have to add it to the context
not sure how malli lets you do that. I'll have a look
i also tried calling the java fn directly without the wrapping clojure fn. same results ie could not resolve Runtime/..
so it seems that you can provide options to the SCI context somehow: https://github.com/metosin/malli/blob/56533336ceb742e63a84d5c1c13095c0ef5383ef/src/malli/sci.cljc#L12
which brings me here: https://github.com/metosin/malli/blob/48c344b88466c5852e94aa82f20808abc2bf7f04/src/malli/core.cljc#L2252
this is the calling fn https://github.com/metosin/malli/blob/56533336ceb742e63a84d5c1c13095c0ef5383ef/src/malli/core.cljc#L2252
but what should i pass?
yeah. I don't see how as a malli user you can provide extra options there. Better ask in #malli or to @ikitommi here
wait, unrelated to malli, what is sci missing? the Runtime namespace? the error is still unclear
if you want to expose your get-cpus function in SCI, you can do that as follows:
(def ctx (sci/init {:namespaces {'user {'get-cpus get-cpus}}}))
(sci/eval-string* ctx "(get-cpus)")it needs an`:import` instead of :require
you don't get access to host classes by default, they have to be explicitly brought in:
{:classes {'Runtime Runtime}}