This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-05
Channels
- # adventofcode (246)
- # aleph (5)
- # aws (7)
- # beginners (161)
- # boot (3)
- # calva (42)
- # cider (40)
- # clara (10)
- # cljdoc (7)
- # cljs-dev (40)
- # cljsrn (6)
- # clojure (170)
- # clojure-dev (8)
- # clojure-greece (2)
- # clojure-italy (15)
- # clojure-kc (2)
- # clojure-new-zealand (13)
- # clojure-nl (13)
- # clojure-russia (3)
- # clojure-spec (5)
- # clojure-uk (160)
- # clojurescript (72)
- # clojurex (1)
- # cursive (7)
- # data-science (9)
- # datascript (1)
- # datomic (120)
- # devcards (4)
- # emacs (18)
- # figwheel-main (10)
- # fulcro (34)
- # kaocha (3)
- # luminus (1)
- # lumo (6)
- # music (1)
- # nrepl (23)
- # off-topic (2)
- # pedestal (4)
- # re-frame (42)
- # reagent (36)
- # reitit (10)
- # ring-swagger (21)
- # shadow-cljs (124)
- # spacemacs (6)
- # tools-deps (14)
- # unrepl (3)
- # vim (2)
Yes, I’m the ersatz GitHub CI :robot_face: Will kick it off when back to computer.
Reagent fixed the variadic IFn method in 0.7.0 (2017-06-27), should be fine to drop support now
It appears CLJS's defn
quotes the map passed in as metadata, whereas CLJ doesn't.
CLJS:
cljs.user=> (defn x {:x/y (atom 1)} [z] (inc z))
#'cljs.user/x
cljs.user=> (-> x quote resolve meta :x/y)
(atom 1)
CLJ:
user=> (defn x {:x/y (atom 1)} [z] (inc z))
#'user/x
user=> (-> x quote resolve meta :x/y)
#object[clojure.lang.Atom 0x27494e46 {:status :ready, :val 1}]
Intended?it’s certainly intentional in clj
strange... I'd think the atom would get eval'd by the time we get here https://github.com/clojure/clojurescript/blob/r1.10.439/src/main/clojure/cljs/core.cljc#L3206 and I don't see any quoting of the meta prior
isn’t this line responsible for quoting? https://github.com/clojure/clojurescript/blob/r1.10.439/src/main/clojure/cljs/core.cljc#L3218
I'm not familiar with this def :macro true
thing. Can we unquote in this body like regular macros?
I’m noob, but I would work around it by writing my own macro, which would set metadata on the var after defn macro executes. There must be a way how to mutate metadata on a var.
aahk, Metadata of vars cannot be altered since they are statically determined at compile-time.
@john CLJS does not have vars at runtime so you can't alter it or use it in the way you'd do with CLJ
since vars don't exist it would create a "new" instance of whatever metadata you created. it would never be the same instance of an atom for example
(var 'the.thing/foo)
recreates the metadata from the analyzer data (at compile time. not runtime)
@thheller Thanks. Yeah, I figured. But technically I'm not altering it... But I guess any data you're passing in via the metadata option must be readable by both CLJ and CLJS? I'm assuming the construction is on the CLJ side? So the atom would be a CLJ atom at this phase?
well you can do some rather ugly hacks with macros but please don't. its not gonna be reliable and break all caching.
Well, I guess if you could, that sure would side-step the lack of alter on vars at runtime. Cool. I'll just use another atom outside