This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-04
Channels
- # bangalore-clj (3)
- # beginners (23)
- # boot (89)
- # cider (11)
- # cljs-dev (22)
- # cljsjs (5)
- # cljsrn (21)
- # clojure (141)
- # clojure-android (1)
- # clojure-berlin (1)
- # clojure-greece (1)
- # clojure-italy (13)
- # clojure-mke (2)
- # clojure-nl (8)
- # clojure-norway (5)
- # clojure-russia (22)
- # clojure-sg (4)
- # clojure-spec (38)
- # clojure-uk (109)
- # clojurescript (150)
- # consulting (4)
- # core-async (7)
- # cursive (13)
- # datascript (8)
- # datomic (72)
- # dirac (185)
- # emacs (5)
- # figwheel (2)
- # flambo (1)
- # hoplon (13)
- # immutant (6)
- # lambdaisland (7)
- # lumo (46)
- # off-topic (13)
- # om (4)
- # onyx (1)
- # pedestal (1)
- # re-frame (68)
- # reagent (15)
- # rum (16)
- # slack-help (4)
- # spacemacs (22)
- # specter (3)
- # vim (10)
- # yada (28)
Found today that we can't close over locals in the clj
version of ui
.
(let [a 1]
(ui Object (render [this] a)))
;; => CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context
Seems like it's not possible to close over locals vars with defrecord
Could you try something like
(let [foo (ui Object (render [this] (:a this)))] (assoc foo :a "bar"))
?
ui
returns a function which takes props and stuff, not an instance of the record:
(assoc (om/ui Object (render [this] (:a this))) :a 1)
ClassCastException clojure.lang.AFunction$1 cannot be cast to clojure.lang.Associative
Created a macro om-ui
which defines vars and replaces the vars for new generated symbols in the body passed to om.next/ui
:
https://gist.github.com/petterik/28c2fff796edbf4aa12e0e043e9342b0