Fork me on GitHub
#clojurescript
<
2020-08-23
>
Sam Ritchie16:08:39

update on the above - it totally does work, since reader literals get processed in Clojure first. Thanks @alexmiller for the tip. (in self-hosted mode I imagine it won't in current CLJS versions that don't parse ratios, but that's a fine caveat to mention to folks)

David Strawn16:08:17

I would like to evaluate CLJS from a React project - does anyone have advice on how to do that? (currently looking at: https://github.com/nasser/clojurescript-npm)

serioga17:08:43

Hi. I have an idea to generate list of imported files in CLJS file with macros. But when I just put (require 'my-ns) in the source then I get error from google compiler

ERROR: JSC_MISSING_MODULE_OR_PROVIDE. Required namespace ... never defined.
Can I realise my idea in any way? Or it is not possible to declare CLJS imports dynamically β€œby design”?

dnolen17:08:14

@serioga not yet possible but there is a patch in the works

serioga17:08:27

@dnolen is there any public ticket for this?

thheller17:08:37

speaking of the devil ... just posted a comment on that

πŸ˜‚ 1
David Strawn18:08:47

is there for example a javascript file that can be included that provides eval capabilities in the browser?

lpan21:08:58

Hey folks, I am trying to define a macro in ClojureScript that involves some core.async stuff such as <! >! and go. I created src/cljs/myapp/macro.cljc and defined a macro there

(ns myapp.macro
  (:require [cljs.core.async :refer-macros [go]]
            [cljs.core.async :refer [<! >!]]))

(defmacro my-macro ; .....
)
However, it doesn't work and here is the stacktrace 😒

thheller21:08:05

but the problem here is that <! does not exist on the macro CLJ side

thheller21:08:26

so don't refer it and instead use cljs.core.async/<! or ~'<! in the macro

lpan22:08:21

Thanks so much Thomas! It works now πŸ˜„

πŸ‘ 1
lpan22:08:46

Also really appreciate your work on shadow-js! I am a big fan πŸ™‚

😎 1
lpan21:08:58

failed to require macro-ns "myapp.macro", it was required by "myapp.core"
Error in phase :compile-syntax-check
IllegalAccessError: <! does not exist
	clojure.core/refer (core.clj:4249)
	clojure.core/refer (core.clj:4217)
	clojure.core/apply (core.clj:667)
	clojure.core/load-lib (core.clj:5966)
	clojure.core/load-lib (core.clj:5928)
	clojure.core/apply (core.clj:667)
	clojure.core/load-libs (core.clj:5985)
	clojure.core/load-libs (core.clj:5969)
	clojure.core/apply (core.clj:667)
	clojure.core/require (core.clj:6007)
	clojure.core/require (core.clj:6007)
	myapp.macro/eval59848/loading--6721--auto----59849 (macro.cljc:1)
	myapp.macro/eval59848 (macro.cljc:1)
	myapp.macro/eval59848 (macro.cljc:1)
	clojure.lang.Compiler.eval (Compiler.java:7177)
	clojure.lang.Compiler.eval (Compiler.java:7166)
	clojure.lang.Compiler.load (Compiler.java:7636)
	clojure.lang.RT.loadResourceScript (RT.java:381)
	clojure.lang.RT.loadResourceScript (RT.java:372)
	clojure.lang.RT.load (RT.java:459)
	clojure.lang.RT.load (RT.java:424)
	clojure.core/load/fn--6839 (core.clj:6126)
	clojure.core/load (core.clj:6125)
	clojure.core/load (core.clj:6109)
	clojure.core/load-one (core.clj:5908)
	clojure.core/load-one (core.clj:5903)
	clojure.core/load-lib/fn--6780 (core.clj:5948)
	clojure.core/load-lib (core.clj:5947)
	clojure.core/load-lib (core.clj:5928)
	clojure.core/apply (core.clj:667)
	clojure.core/load-libs (core.clj:5985)
	clojure.core/load-libs (core.clj:5969)
	clojure.core/apply (core.clj:667)
	clojure.core/require (core.clj:6007)
	clojure.core/require (core.clj:6007)
	shadow.build.macros/load-macros/fn--13791/fn--13802 (macros.clj:101)
	shadow.build.macros/load-macros/fn--13791 (macros.clj:100)
	shadow.build.macros/load-macros (macros.clj:94)
	shadow.build.macros/load-macros (macros.clj:85)
	shadow.build.compiler/post-analyze-ns (compiler.clj:51)
	shadow.build.compiler/post-analyze-ns (compiler.clj:48)
	shadow.build.compiler/post-analyze (compiler.clj:94)
	shadow.build.compiler/post-analyze (compiler.clj:91)
	shadow.build.compiler/analyze/fn--13935 (compiler.clj:252)
	shadow.build.compiler/analyze (compiler.clj:239)
	shadow.build.compiler/analyze (compiler.clj:198)
	shadow.build.compiler/analyze (compiler.clj:200)
	shadow.build.compiler/analyze (compiler.clj:198)
	shadow.build.compiler/default-analyze-cljs (compiler.clj:366)
	shadow.build.compiler/default-analyze-cljs (compiler.clj:355)
	clojure.core/partial/fn--5839 (core.clj:2625)
	shadow.build.compiler/do-analyze-cljs-string (compiler.clj:307)
	shadow.build.compiler/do-analyze-cljs-string (compiler.clj:265)
	shadow.build.compiler/analyze-cljs-string/fn--14010 (compiler.clj:467)
	shadow.build.compiler/analyze-cljs-string (compiler.clj:466)
	shadow.build.compiler/analyze-cljs-string (compiler.clj:464)
	shadow.build.compiler/do-compile-cljs-resource/fn--14038 (compiler.clj:581)
	shadow.build.compiler/do-compile-cljs-resource (compiler.clj:563)
	shadow.build.compiler/do-compile-cljs-resource (compiler.clj:521)
	shadow.build.compiler/maybe-compile-cljs/fn--14137 (compiler.clj:904)
	shadow.build.compiler/maybe-compile-cljs (compiler.clj:903)
	shadow.build.compiler/maybe-compile-cljs (compiler.clj:879)
	shadow.build.compiler/par-compile-one (compiler.clj:1012)
	shadow.build.compiler/par-compile-one (compiler.clj:967)
	shadow.build.compiler/par-compile-cljs-sources/fn--14173/iter--14195--14199/fn--14200/fn--14201/fn--14202 (compiler.clj:1085)
	clojure.core/apply (core.clj:665)
	clojure.core/with-bindings* (core.clj:1973)
	clojure.core/with-bindings* (core.clj:1973)
	clojure.core/apply (core.clj:669)
	clojure.core/bound-fn*/fn--5749 (core.clj:2003)
	java.util.concurrent.FutureTask.run (FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
	java.lang.Thread.run (Thread.java:748)