This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-09
Channels
- # announcements (12)
- # beginners (159)
- # boot (3)
- # calva (41)
- # cider (48)
- # clara (2)
- # clj-kondo (8)
- # cljdoc (8)
- # clojure (70)
- # clojure-dev (10)
- # clojure-europe (2)
- # clojure-losangeles (1)
- # clojure-nl (12)
- # clojure-spec (7)
- # clojure-uk (63)
- # clojurescript (24)
- # cursive (24)
- # datomic (22)
- # expound (17)
- # figwheel (1)
- # fulcro (176)
- # graphql (23)
- # jobs (9)
- # jobs-discuss (56)
- # kaocha (1)
- # mount (3)
- # nyc (1)
- # off-topic (91)
- # onyx (3)
- # overtone (4)
- # pathom (3)
- # pedestal (1)
- # re-frame (11)
- # reitit (19)
- # ring (8)
- # shadow-cljs (16)
- # test-check (5)
- # testing (2)
- # tools-deps (20)
- # vim (9)
is it possible to introduce a def
programmatically in Clojurescript without using a macro? I can’t use clojure.core/intern
, using eval also didn’t work as I expected
could you have a shadow-environment?
(def runtime-environment (atom {}))
and instead of def
ing things are runtime rather (swap runtime-environment assoc (name x) x))
or something?
if it’s just to clean up some boilerplate, a macro might suffice. if it’s to do some other kind of runtime malarkey, another solution might work
I have this js/BigObject with bunch of keys, we have a namespace that basically manually does something like (def foo (adapt-react-class (gobj/get js/BigObject “foo”)). I need to find a way to do it more cleanly
yeah, a macro will give you cleaner access via namespace, but you’ll have to enumerate the keys
there’s not a way to do this at runtime AFAIK that wouldn’t break advanced compilation
at runtime, you can’t define a variable in a namespace because it might (will) be renamed when advanced optimizations are done