Is this possible in GraalVM?
(eval '(defmacro testing [] 123))
(println (macroexpand '(testing)))
I'm getting
Exception in thread "main" Syntax error macroexpanding clojure.core/defmacro at (36:10).
at clojure.lang.Compiler.checkSpecs(Compiler.java:6972)
at clojure.lang.Compiler.macroexpand1(Compiler.java:6988)
at clojure.lang.Compiler.macroexpand(Compiler.java:7075)
at clojure.lang.Compiler.eval(Compiler.java:7161)
at clojure.lang.Compiler.eval(Compiler.java:7132)
at clojure.core$eval.invokeStatic(core.clj:3216)
at clojure.core$eval.invoke(core.clj:3212)
at some_project.main$_main.invokeStatic(main.clj:36)
at some_project.main$_main.doInvoke(main.clj:35)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at some_project.main.main(Unknown Source)
Caused by: java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class, clojure/spec/alpha.clj or clojure/spec/alpha.cljc on classpath.
at clojure.lang.RT.load(RT.java:462)
at clojure.lang.RT.load(RT.java:424)
at clojure.lang.Compiler.ensureMacroCheck(Compiler.java:6957)
at clojure.lang.Compiler.checkSpecs(Compiler.java:6970)
Currently running [org.clojure/clojure "1.10.2-alpha1"]
Sci does manage to do it. Not sure how though
Not possible in GraalVM. Sci works around it by being an interpreter.
Ahh ok, got it
I guess I could try to use sci in that case
Awesome, that works
Guess I'll be using Sci afterall ๐
I donโt think we talk about runtime evaluation in our clj-graal-docs, Iโll add a tip.
iirc the story behind babashka is intimately related to this point, a train ride and jet...or something
Thanks for the nudge, listed babashka as the a great example of evaluating Clojure code.