This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-06
Channels
- # aleph (79)
- # bangalore-clj (3)
- # beginners (49)
- # boot (74)
- # cider (10)
- # cljs-dev (21)
- # cljsrn (2)
- # clojure (105)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-dusseldorf (1)
- # clojure-korea (1)
- # clojure-poland (3)
- # clojure-russia (38)
- # clojure-spec (146)
- # clojure-uk (20)
- # clojurescript (70)
- # cloverage (1)
- # component (1)
- # core-async (23)
- # css (16)
- # cursive (22)
- # datascript (1)
- # datomic (22)
- # defnpodcast (6)
- # emacs (60)
- # events (1)
- # hoplon (94)
- # jobs (1)
- # jobs-rus (13)
- # luminus (11)
- # off-topic (11)
- # om (48)
- # onyx (5)
- # proton (7)
- # re-frame (87)
- # reagent (39)
- # rethinkdb (1)
- # ring-swagger (14)
- # rum (6)
- # specter (14)
- # untangled (105)
- # vim (6)
- # yada (22)
I'm new to looking at the source code, and I see dynamic vars being used for binding context for the environment(s). Just curious is there a reason that dynamic vars were used, necessitating binding, instead of something like atoms to represent the values that could be passed into the functions?
maybe you have run into https://github.com/cursive-ide/cursive/issues/1554 as well?
@dnolen (cont. the discussion from #clojure-spec): would you like a patch to clojurescript
that brings specs.clj
from clojure
?
@dnolen here is the JIRA ticket http://dev.clojure.org/jira/browse/CLJS-1813
@dnolen It was kind of a half-cocked question. I am looking at the code along the path where i use lein cljsbuild auto
. I think I am just a little mixed up due to reading through the code quickly. I am going to spend more time to make sense of it, but I am curious. Since you mentioned there is a how/why for use of dynamic bindings, could you elaborate on that a little?
It comes from my experience so far that I have just used atoms to manage state, and I am still trying to get a feel for when it is appropriate to use dynamic bindings
I do have some materials (a number of books and I've found posts by Stuart Sierra about it). If it is arbitrary, fine.
@tomjkidd there a couple of nice things, bindings are thread local - we often bind value at the start of processing a file on thread (i.e. :parallel-build true
)
@tomjkidd I tend to think about bindings as “temporary hidden parameters”, it is a way how to pass parameters to functions which will be called down from you stack frame (by current thread in case of clojure)
this way you don’t need to change signatures of intermediate functions, which could be impractical
e.g. imagine a world where you had to pass *out*
to every function because they might want to call println
of course you could achieve similar results with atoms or other global refs, but bindings are lightweight, explicitly thread-bound and “temporary”, they should not hold persistent app-state in a sense as atoms do, they should contain only temporary parametrizations valid for a function call at hand