@tony.kay I think you said something about ui-reactkey but I couldn't read it at the time; now I can't find it. Did you delete it or has slack lost it for me? EDIT: Nvm, I found it in #om
@nha are you familiar with the new implicit macro stuff for cljs? It seems you changed one (or more) of my refers to a conditional in cljc
@tony.kay not familiar with macros in cljs at all
Actually I was struggling quite a bit right now đ
Thanks for your commit by the way đ it helps having the tooling to work on this
yes, it doesâŚalso the fact that there are macros involved in cljc can be a challenge
Yes well I never wrote a useful macro even in clj, so I am learning both at the same time. What is this implicit macro stuff?
itâs just a way you can avoid needing to do the :refer-macros
stuff
unifies the syntax a bit
http://blog.fikesfarm.com/posts/2016-03-01-clojurescript-macro-sugar.html
The âImplicit Sugarâ section
I thought :`refer-macros` was the new bit ^^ Thanks will read đ
but since youâre in cljc, you have to add the self-refer in a cljs conditional block.
Oh right I kinda remember reading that now đ
no, refer-macros
is because the macros happen in clj before the compile
so, it is telling the cljs compiler to go load them into the clj env
text file -> EDN read -> data structures -> macro expansion -> expanded data structures -> compile
Ah makes sense đ
when you have a cljc file, youâve got two things youâre generating that have the same kinda path: clj and cljs
The EDN read step just sets up to emit whichever side of a conditional is relevant (clj or cljs)
text file -> cljs EDN read -> cljs data structures -> macros -> expanded -> compile
so the macro needs to emit something that will work on either side
So if there was a #?(:cljs (:require-macros untangled-spec.core))
in https://github.com/untangled-web/untangled-spec/blob/develop/src/untangled_spec/core.clj#L1 and it was a cljc
file it would have worked? That's nice
easier to write that so the macro uses helper functions that you can make behave properly
rightâŚif you have that, you can just :refer
and it is transparent
unfortunately not all libs have ported to that, so sometimes youâre still stuck with :refer-macros
Ok that refines my mental model of cljs macros đ
and in cljc it gets super-confusing, because the refer
will work no matter what there for the CLJ side of the compile
but will complain when doing the cljs that it canât find it
yes I kinda understood that part. compile vs run time (I think)
and on your ref to spec.
https://github.com/untangled-web/untangled-spec/blob/develop/src/untangled_spec/core.cljs
DOES have the require-macros
you can have CLJ and CLJS file separatelyâŚworks fine
does not have to be a cljc file per-se
so you can use :refer
with it
the implicit stuff is enabled when the CLJS file requires the macros from the like-named clj namespace
Oh ok makes sense after all. cljc emits clj + cljs files so you can do it yourself đ
right
Yeah, worth learning these little ins-and-outs of macros. They make the whole thing less of a hair-pulling experience
If you just try to âdo itâ in an experimental fashion, it is maddening