graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
kwrooijen 2020-08-08T13:26:44.130800Z

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)

kwrooijen 2020-08-08T13:27:16.131100Z

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

kwrooijen 2020-08-08T13:40:02.131400Z

Sci does manage to do it. Not sure how though

borkdude 2020-08-08T13:42:43.132400Z

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

kwrooijen 2020-08-08T13:43:05.132700Z

Ahh ok, got it

kwrooijen 2020-08-08T13:43:37.133500Z

I guess I could try to use sci in that case

kwrooijen 2020-08-08T13:51:40.133700Z

Awesome, that works

kwrooijen 2020-08-08T13:54:47.134Z

Guess I'll be using Sci afterall ๐Ÿ˜›

1
lread 2020-08-08T14:44:21.135Z

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

2โค๏ธ
lread 2020-08-08T14:55:53.135400Z

https://github.com/lread/clj-graal-docs#runtime-evaluation

1โœ”๏ธ1๐Ÿ‘Œ
2020-08-08T23:28:46.137700Z

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

121
lread 2020-08-09T16:26:44.138600Z

Thanks for the nudge, listed babashka as the a great example of evaluating Clojure code.

1๐Ÿ‘