This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-12
Channels
- # announcements (6)
- # babashka (45)
- # beginners (4)
- # calva (19)
- # cider (2)
- # clj-kondo (10)
- # clj-yaml (10)
- # clojure (25)
- # clojure-boston (1)
- # clojure-conj (3)
- # clojure-europe (34)
- # clojure-losangeles (5)
- # clojure-nl (1)
- # clojure-norway (11)
- # clojure-uk (2)
- # clojurescript (84)
- # cursive (10)
- # datalevin (3)
- # figwheel-main (1)
- # fulcro (1)
- # jobs (5)
- # joyride (25)
- # lsp (17)
- # malli (18)
- # nbb (1)
- # off-topic (1)
- # re-frame (22)
- # remote-jobs (9)
- # scittle (3)
- # shadow-cljs (26)
- # sql (16)
- # tools-build (12)
- # xtdb (44)
Hello everyone, I'm trying to execute some code in a build-hook (:compile-prepare stage) that need to know which namespaces will be recompiled, or at least which namespace has triggered the hot-reloading. I cannot find this information in the build-state
that my hook receives. Does anyone has an idea ? thank you.
the set of sources that will be recompiled you can get by inspecting :build-sources
, which is a vector of resource-ids. if there is a corresponding (get-in build-state [:output resource-id])
it won't be recompiled. otherwise it will be
maybe 🙂 but I cannot think of an alternative, I've got an atom that hold some kind of environment to be used in expansions depending on the targetting platform.
so builds may become unpredictable with the state of the atom and cache in mind. unless of course you disable all caching, which again is really bad 😉
oh and you can get more information about the source that is getting recompiled via (get-in build-state [:sources resource-id])
Yes but I cannot find a better way to do what I want for now. I will try to explain what I'm trying to achieve better in order for you to be able to do wise suggestions 🙂
It is a library that aims to let me define and implement protocols in a cross-platform way (clj and cljs) without reader conditionals. For being able to do this I need to keep track of which type implements which methods and things like this. It is clearly a bad idea but its almost done and I would like to fix this hot-reloading issue (on the first compilation everything works) .
hmm but how do you track protocol implementations? I mean how would you "find" reify
?
I'm not tracking reified things and do not intend to do so, I do not track already existing protocols neither. When a new method is defined using one of my macro, I capture all informations in my expansion-time state. In addition to that, I store all "prototypes" in a runtime atom, that can be used to share method implementations. Its kind of baroque I agree but I works like I want for now.
I think that the information that you gave to me will allow me do what I need, so thank you a lot !
question - I’m writing a cljs macro and want to be able to reference something from box
given
(:require ["mathbox-react" :as box]
[reagent.core :as r])
is there a way to make a “fully qualified” symbol with a string namespace? I am not sure how to get the alias to resolve, since the macro is expanded on the clojure side
its best to just make a wrapper function and call that from the macro. So in the CLJS part (defn get-me-the-thing [] box/foo)
or whatever.
I am trying to build the core there from a symbol, like Group
;
(def Group (reagent.core/adapt-react-class box/Group)
, basically
so I can write (defprim Group <some-map-that-I-will-turn-into-a-docstring>)
oh, it’s easier to go the other way… (defprim box/Group )
and then strip off the namespace for the symbol I feed to def