You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I now load the my/app.cljs file, I now should be able to use the macro, and expect it to print 123 when it is loaded, but it fails on the first load, and starts to work if I load the file again:
% npx shadow-cljs node-repl
shadow-cljs - config: /Users/pez/Projects/sass2garden/shadow-cljs.edn
[2022-11-01 23:41:15.678 - WARNING] TCP Port 9630 in use.
[2022-11-01 23:41:15.681 - WARNING] TCP Port 9631 in use.
shadow-cljs - server version: 2.20.7 running at http://localhost:9632
shadow-cljs - nREPL server started on port 58439
(lcljs.user=> oshadow-cljs - #4 ready!
ad-file "src/main/my/app.cljs")
------ WARNING - :undeclared-var -----------------------------------------------
Resource: <eval>:4:9
Use of undeclared Var util/foo
--------------------------------------------------------------------------------
cljs.user=> (load-file "src/main/my/app.cljs")
123
[]
cljs.user=>
However, if I place the macro in my.util, things work as expected.
Please note, @thheller, that (require 'my.app) works. My repro in that Slack conversation was crap. This seems to be with load-file.
The text was updated successfully, but these errors were encountered:
I can reproduce the problem when using load-file and your "flat" namespaces. I can also reproduce moving the namespaces to a proper structure (ie. no single-segment namespaces, util becomes my.util) working just fine. Not yet sure why though.
From this discussion in Slack.
Following this example, for how to work with macros in ClojureScript, fails in the REPL if I define the macro in a top-level namespace:
util.clj
:util.cljs
:my/app.cljs
:If I now load the
my/app.cljs
file, I now should be able to use the macro, and expect it to print123
when it is loaded, but it fails on the first load, and starts to work if I load the file again:However, if I place the macro in
my.util
, things work as expected.Please note, @thheller, that
(require 'my.app)
works. My repro in that Slack conversation was crap. This seems to be withload-file
.The text was updated successfully, but these errors were encountered: