This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-24
Channels
- # babashka (9)
- # beginners (17)
- # biff (1)
- # calva (3)
- # cider (29)
- # clj-kondo (31)
- # clojure (59)
- # clojure-austin (12)
- # clojure-brasil (12)
- # clojure-europe (35)
- # clojure-nl (1)
- # clojure-norway (72)
- # clojure-uk (1)
- # clojurescript (15)
- # clr (4)
- # conjure (1)
- # cursive (2)
- # datahike (2)
- # emacs (3)
- # hyperfiddle (114)
- # introduce-yourself (1)
- # kaocha (3)
- # malli (7)
- # off-topic (19)
- # pathom (2)
- # polylith (5)
- # portal (5)
- # reitit (5)
- # shadow-cljs (2)
- # slack-help (4)
- # tools-deps (42)
- # xtdb (6)
Hi everybody! Is this a bug or am I missing something? I want to run a repl with a watch using cljs.main :
if I do clj -M --main cljs.main --watch "src" --compile hello-world.core --repl
the repl starts, and it says Watch compilation log available at: out/watch.log
but nothings happens when I modify a file and nothing on that log.
if I do the same but removing the --repl
the the watch works, but I have no repl
And I also tried clj -M --main cljs.main --repl-opts '{:watch "src"}' --compile hello-world.core --repl
which starts a repl but doesn't start any watch
all this is using ClojureScript 1.11.60
Hi Folks - Trying to write a macro using CLJS "1.11.54"
and I can’t seem to even get it to print out the arguments being passed in. Anyone know what I’m doing wrong?
(defmacro print-symbol-macro [ns-str]
(println ns-str)
`(println ~ns-str))
(print-symbol-macro "cljs.core") ; => Returns (println nil), prints nil
That works in Clojure. Do you have the macro definition in a .clj
file? Then invoke it from a .cljs?
And when you say "prints nil", println
itself returns nil.
Right. Let me try another example:
(defmacro unless
[pred & body]
`(if (not ~pred)
(do ~@body)
nil))
(unless true
(do
(println "I should *not* print")
(+ 1 2 3)))
This ends up printing "I should *not* print"
, and also shows the following in the console: (if (cljs.core/not nil) (do) nil)
In Clojure, this does evaluate properly and does not print anything
When I update unless
to read:
(defmacro unless
[pred & body]
(prn pred body) ; THIS IS NEW
`(if (not ~pred)
(do ~@body)
nil))
In CLJS:
I should *not* print
nil nil
In CLJ:
true ((do (println "I should *not* print") (+ 1 2 3)))
So it looks to me that CLJS defmacro
is just not even taking arguments anymore
Here’s another one:
(defmacro infix [[a op b]]
`(~op ~a ~b))
(infix (1 + 1))
CLJS:
:value "#object[TypeError TypeError: 1.call is not a function]",
:ua-product :chrome,
:stacktrace
"TypeError: 1.call is not a function\n at eval (eval at figwheel$repl$eval_javascript_STAR__STAR_ (), <anonymous>:1:103)\n at eval (eval at ...
CLJ:
2
follow https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html