This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-06
Channels
- # aleph (2)
- # aws (3)
- # bangalore-clj (3)
- # beginners (119)
- # boot (263)
- # cider (13)
- # cljs-dev (16)
- # clojars (2)
- # clojure (114)
- # clojure-austin (1)
- # clojure-chicago (1)
- # clojure-finland (1)
- # clojure-france (24)
- # clojure-italy (6)
- # clojure-russia (28)
- # clojure-serbia (7)
- # clojure-spain (1)
- # clojure-spec (89)
- # clojure-uk (139)
- # clojurescript (216)
- # community-development (3)
- # core-async (135)
- # css (2)
- # cursive (31)
- # datomic (44)
- # emacs (15)
- # hoplon (2)
- # jobs (3)
- # lein-figwheel (14)
- # leiningen (2)
- # lumo (21)
- # off-topic (16)
- # om (7)
- # om-next (1)
- # onyx (53)
- # perun (9)
- # planck (15)
- # portland-or (29)
- # protorepl (2)
- # re-frame (32)
- # reagent (8)
- # ring-swagger (22)
- # rum (51)
- # spacemacs (4)
- # untangled (2)
I wish I could share the reasons for the delays; it would be amusing if it wasn’t happening to us!
There’s another GraphQL implementation out there, it’s just not nearly as sophisticated as ours. You could start prototyping.
it's basically a way of creating singletons with state, and managing the dependencies between them
Once I hit about ten defstate
singletons in my app it started getting way too hard juggling those for testing
overall I still like mount more than component, so I'm not planning to switch anytime soon, but I've been moving towards a pattern like
this has made testing about 100x easier, and things still work as expected in dev/prod
it's nicer in dev, as I can spin up a second server on another port or with a different config as needed
@mattly how is Component not "basically a way of creating singletons with state, and managing the dependencies between them”? In this respect I feel like Component and Mount are equivalent.
One key difference I see is syntactic. w/ Component, every single fn that wants to access the ugly state has to take it as a parameter whereas with Mount the reference to the ugly state is made by require so functions may close over those references.
I realize how ugly that sounds. The resulting namespaces look a lot more like ugly namespaces written using dynamic vars to set default state which gets redefined in test and prod using with-redefs
. OTOH with Mount, (unlike with-redefs
) the state is not thread-local.
not singleton/state in a thread sense but in a "there is a fixed reference point to it in the global namespace" sense
and wouldn’t I try to use Component the same way, i.e., try to have the minimum number of Components I could possibly have?
...don't get me wrong, I think either mount or component is vastly superior overall to using neither
So I was all excited about Component as the 500 LoC Clojure answer to my colleagues’ 80K LoC Guice (for Java). Then I got excited about Mount because Component seemed like it’d lead to essentially lots of Components and OO-ish badness in actual practice, and I thought Mount was better. Now I am more and more inclined toward dependency rejection a la: http://blog.ploeh.dk/2017/01/27/from-dependency-injection-to-dependency-rejection/
^ that article takes you in about 30-minutes to indirect output and indirect input via monads without using That Word. sigh
I too, am curious @mattly! I’m starting with Who In Their Right Mind Would Use Monads in Clojure?: http://blog.muhuk.com/2015/10/01/who_in_their_right_mind_would_use_monads_in_clojure.html
One thing I'm trying to do, per the example above, is move towards having each thing handle it's own configuration & validation based on what's passed in, and then having only the mount pieces explicitly use the other mount pieces