This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-18
Channels
- # announcements (2)
- # architecture (10)
- # beginners (51)
- # cider (14)
- # cljsrn (1)
- # clojure (13)
- # clojure-uk (3)
- # clojurescript (63)
- # cursive (1)
- # datomic (8)
- # emacs (1)
- # figwheel (1)
- # figwheel-main (18)
- # fulcro (62)
- # hyperfiddle (1)
- # incanter (1)
- # jobs-discuss (4)
- # off-topic (3)
- # parinfer (6)
- # reagent (5)
- # ring-swagger (3)
- # shadow-cljs (25)
- # sql (2)
- # tools-deps (2)
Is there a way for macros to expand such that they contain private vars, short of using #'
?
I’m not aware of any way. (In fact in some ClojureScript core macros there is a bit of a hack to work around that in order to avoid unnecessary code bloat. https://github.com/clojure/clojurescript/commit/3123aa32851c01682cf076e0e3b497e890b26922)
@mfikes OT, why ~js*
over #'
? I'm writing clojure, so I don't think I have an option, but I'm curious
Right, in Clojure, I’m not aware of such a workaround. (In Clojure, if pressed, I’d make a var public but name it something that indicates its private nature, maybe foo*
)
In ClojureScript, the use of var
is problematic because it expands to a bunch of JavaScript. That’s arguably OK in many cases, but in those particular core macros, it is a hard pill to swallow, given the potential effect on generated code size.
(So, in those core macros it uses js*
because it knows what it’s doing and that essentially emits the desired JavaScript—`js*` is used often in ClojureScript’s core macros.)
Dunno, perhaps something similar is possible via Java interop if you really really need to do it in Clojure.
That's very interesting. Very cool 🙂. I suppose that could easily become undone without knowing why it's like that :thinking_face:. I'm thinking I'll move the code to an impl namespace where it's public. This is the first time I've actually needed impl rather than just using it for aesthetic reasons.
@hiredman, it seems to be a hard incompatibility. I tried the example code from the front page and am getting random errors depending on what i change. the most recent is java.lang.NoClassDefFoundError: org/eclipse/jetty/server/NegotiatingServerConnection$CipherDiscriminator