This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-29
Channels
- # announcements (5)
- # beginners (25)
- # calva (53)
- # clj-kondo (9)
- # clojure (25)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-uk (1)
- # conjure (2)
- # data-science (1)
- # datalevin (4)
- # datascript (6)
- # deps-new (5)
- # emacs (5)
- # etaoin (6)
- # figwheel-main (1)
- # fulcro (46)
- # gratitude (3)
- # hyperfiddle (8)
- # introduce-yourself (13)
- # lsp (13)
- # nextjournal (5)
- # off-topic (2)
- # pathom (4)
- # polylith (11)
- # re-frame (16)
- # releases (4)
- # scittle (67)
- # shadow-cljs (38)
- # slack-help (4)
- # specter (13)
- # sql (29)
- # squint (21)
- # test-check (3)
- # vim (13)
- # xtdb (15)
I was able to fix my issue by declaring the dependencies Datalevin wanted, though I don’t know what exactly caused it.
Hi - is there anywhere in the compiler state that records a timestamp or datetime of when a namespace was last loaded? Or similarly - any info about which namespaces are stale when a code change is noticed (before a hot-reload)? The use-case is for malli function instrumentation and wanting to only instrument stale namespaces instead of doing a full ns scan on each hot reload.
it does but not in a way that would be accessible to malli? which I assume uses a macro to do this?
ah ok - Yea I was thinking the macro could make that data visible to the cljs runtime which would then be able to filter on it
Maybe you can use a build hook @danvingo? https://shadow-cljs.github.io/docs/UsersGuide.html#build-hooks
For example, in our build we look at some data in the compiler-env and throw an exception sometimes in the {:shadow.build/stage :compile-finish}
stage, which shadow-cljs displays in the browser
thanks for the suggestion! I will play around with it, might be able to hack something (like writing to a file with generated code) idk
Here an example of updating the compiler env in a macro, then using that in a build hook (translation use-case): https://www.isaksky.com/posts/macro-assisted-translations-in-clojurescript/
FWIW I have been thinking of introducing a formal API that is called after compilation and basically lets you generate extra code. sort of like looking at metadata and generating code for it. in clojure you can just do that at runtime dynamically but CLJS you can't. so that might bridge that a little.
would this enable tracing use cases ?
I don't know? haven't thought about tracing in a long long time so not sure what that needs?
I imagine the ability to walk/inspect the tree of code and inject custom tracing code at many points (e.g. every fn call)
I mean that could be done elsewhere. if you have a formal definition of what would be needed I could certainly add that
I'm not sure if this API would be the best place to serve that requirement or not ?
no, this one doesn't seem to be. the idea is that for example I have metadata in my projects which "tags" certain functions as event handlers
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/ui/db/inspect.cljs#L126
so basically the macro generates (rf/reg-event ::m/tap-clear! that.ns/var)
(none of this actually uses re-frame, but it is very similar in concept)
but the macro has the problem that it needs to run after all other compilation is completed