This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-20
Channels
I was just messing about with https://github.com/halfzebra/create-elm-app
I defined a macro in a clj file and am using :require-macros to use it in a cljs file but I'm getting a build failure
22 | ^{:key letter} [letter-button letter])
23 | "Now in the drum-kit-lesson"])
24 |
25 | (create-lesson letters)
-------^------------------------------------------------------------------------
ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Named
clojure.core/namespace (core.clj:1589)
clojure.core/namespace (core.clj:1589)
cljs.analyzer/fn--1733 (analyzer.cljc:1491)
cljs.analyzer/fn--1733 (analyzer.cljc:1473)
clojure.lang.MultiFn.invoke (MultiFn.java:251)
cljs.analyzer/analyze-seq* (analyzer.cljc:3348)
cljs.analyzer/analyze-seq* (analyzer.cljc:3346)
cljs.analyzer/analyze-seq*-wrap (analyzer.cljc:3353)
--------------------------------------------------------------------------------
@theeternalpulse looks like a macro error, probably generating invalid code
this is my macro. I've reduced it down quit a bit to test and was still getting the error
(defmacro create-lesson [component]
`(def 'lesson (if style
(with-meta `'~component {:style style})
`'~component)))
I'm basically trying to create a def in a namespace that attaches style metadata so when the component is mounted with reagent it also mounts a style tag to the header
I see. I wanted to create a local def called lesson where the macro is used, and not have it try to resolve a namspace.
I am really jsut trying to attach metadata to a clojurescript function but I was reading and in order to fetch it I have to get a reference to thee var, which I can't do in clojurescript
so I just wanted to create a simple thing that would do (def lesson (with-meta fn {:style style}))
if the style var was defined
I guess it's overkill but it piqued my curiosity and led me down that dark path
I always recommend writing the code entirely without macro (if possible) until it works and then eliminate the boilerplate later
yeah, it's a bit harder to debug in clojurescript
even with cider connected, doesn't seem to like macros
yeah, Either way, that cleared it up. I'll go down the easier path, too much of a rabbit hole to be worth it lol
@kenny please open an issue so I don't forgot. the error should be more clear indeed.
@thheller noticed something weird here, I just add my test
folder to my source-paths
, and for some reason, now on my chrome compilations I'm getting start code from fulcro-spec
, which doesn't make sense, on my chrome entry points there is nothing pointing to fulcro-spec
, and this start code from spec is messing up other things, just removing the test
from :source-paths
and recompiling fixes it, any idea what that might be?
there is none there
that's what I'm finding confusing, I have no reference to fulcro-spec on this build
from the clj REPL you can run (shadow.cljs.devtools.api/find-resources-using-ns 'fulcro.spec)
or whatever the ns is
no idea why added test code would become part of you build though. maybe a naming conflict?
other thing, about the nrepl-port, here everytime I run shadow it uses a new port
I though I read something about it creating a file and sticking to that number, do I have to configure anything for that to happen?
the port is always random and always written to .shadow/nrepl.port
by default. you can however configure a fixed port
do you have a way for cursive to pick the port number from that?
I ran the command you said
all the references I'm finding are from my test file sources
is there other way I can try to figure why the spec stuff is leaking into other build?
I may have found it
there was a cljs.user
in the test
directory
yeah, that was it
the experience with chrome + shadow is been awesome, even still incomplete, I'm close to have a beta for fulcro-inspect running as a chrome devtool 🙂