Fork me on GitHub
#graalvm
<
2020-08-08
>
Kevin13:08:44

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)

Kevin13:08:16

Currently running [org.clojure/clojure "1.10.2-alpha1"]

Kevin13:08:02

Sci does manage to do it. Not sure how though

borkdude13:08:43

Not possible in GraalVM. Sci works around it by being an interpreter.

Kevin13:08:05

Ahh ok, got it

Kevin13:08:37

I guess I could try to use sci in that case

Kevin13:08:40

Awesome, that works

Kevin13:08:47

Guess I'll be using Sci afterall 😛

upside_down_parrot 3
lread14:08:21

I don’t think we talk about runtime evaluation in our clj-graal-docs, I’ll add a tip.

❤️ 6
sogaiu23:08:46

iirc the story behind babashka is intimately related to this point, a train ride and jet...or something