This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-09
Channels
- # aleph (1)
- # announcements (7)
- # asami (1)
- # beginners (44)
- # calva (54)
- # cherry (24)
- # cider (6)
- # clj-kondo (19)
- # cljsrn (27)
- # clojure (119)
- # clojure-europe (61)
- # clojure-gamedev (38)
- # clojure-germany (7)
- # clojure-nl (1)
- # clojure-norway (104)
- # clojure-portugal (4)
- # clojure-spec (4)
- # clojure-uk (1)
- # clojurescript (38)
- # cursive (18)
- # datomic (11)
- # emacs (9)
- # events (1)
- # fulcro (4)
- # holy-lambda (7)
- # introduce-yourself (7)
- # jobs (1)
- # malli (6)
- # off-topic (4)
- # pathom (4)
- # pedestal (16)
- # podcasts-discuss (1)
- # polylith (27)
- # portal (17)
- # releases (2)
- # shadow-cljs (46)
- # squint (1)
- # xtdb (9)
Is it possible to get the namespace meta data and doc string in a ClojureScript macro? (meta *ns*)
gives me what I want in Clojure, but in ClojureScript, it seems to only return filename, line and column?
if you look at how var metadata is resolved at macroexpand time (by looking the compilation environment) it should make sense how you can do the same trick to get the ns info
So (get-in @env/*compiler* [:cljs.analyzer/namespaces (symbol (str *ns*))])
gets me the doc string under :doc
and lots of other things, but I can’t seem to get the ns meta?
I have a collection of symbols of cljs core functions.
(def syms '{_EQ_, prn ...})
These symbols are already munged.
But after advanced compilation it seems some symbols get demunged!
Symbols that occur in the un-optimized set but not in the optimized set:
#{_PLUS_ _EQ_ not_EQ_}
Symbols that occur in the optimized set but not in the un-optimized set:
#{= not= +}
Any ideas of why this might happen?I've seen the issue before and then I switched to strings which helped, but I haven't gotten at the root cause of this behavior
If I do this:
(def core-vars (conj (:vars core-config) 'goog_typeOf (symbol "_EQ_")))
then the problem gets fixed
but not when I do:
(def core-vars (conj (:vars core-config) 'goog_typeOf '_EQ_))
it does the constants optimization in a closure compiler pass using the munged symbol as the "key" in a map
ah no, it just emits things twice. but the variable name it creates just overwrites itself
so you have one var cljs$cst$_foo = new cljs.core.Symbol(null, "-foo", ...)
and one var cljs$cst$_foo = new cljs.core.Symbol(null, "_foo",...)
if its the same build then yes, its all done as part of :advanced
over the whole code
@U05224H0W I would consider this a bug. Perhaps the naming cljs$cst$...
can be made more robust, e.g. by using a gensym-ed symbol or so
Does anybody have an example of cljs.test/async
? I'm not quite understanding how to test promise-returning functions properly.
(testing "promise-returner"
(-> (promiser-returner data)
(.then #(is (= {} %)))))
I suspect the result from is
just isn't getting back to the deftest
machinery.I'm afraid I'm not understanding it, though. I've looked at the [async testing]( https://clojurescript.org/tools/testing#async-testing), but they all use async channels and not promises, and I don't understand how to move the is
outside of the promise chain.
(testing "promise-returner"
(let [promise (promise-returner data)]
(async done
(-> promise
(.then #(is (= {} %))))
(done)
0)))