This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-07
Channels
- # 100-days-of-code (13)
- # beginners (12)
- # business (6)
- # cider (6)
- # cljdoc (9)
- # cljs-dev (1)
- # cljsrn (4)
- # clojars (4)
- # clojure (31)
- # clojure-dev (12)
- # clojure-uk (11)
- # clojurescript (16)
- # cursive (1)
- # datascript (4)
- # datomic (10)
- # editors (1)
- # figwheel-main (3)
- # graphql (10)
- # lein-figwheel (29)
- # off-topic (1)
- # pedestal (1)
- # re-frame (31)
- # reitit (3)
- # shadow-cljs (27)
- # slack-help (5)
- # spacemacs (1)
- # yada (5)
Actually, digging a little more into Clojure's compiler source code (in Java), it is also likely that it is wrapping try and catch bodies inside (fn ...)
for a number of different more complex expressions (try/catch, loop/recur, etc) if that expression isn't in the tail of the function, or in the middle of the do (the compiler calls these contexts, and those two are return and statement contexts respectively, the alternative is expression context), the compiler will hoist the code out in to an immediately invoked fn
I have a patch on a jira issue somewhere that changed that to hoist them out as static methods on the fn's class, but the patch still doesn't work right (it interfered with local's clearing), and it was a real pain to do given the single pass nature of the compiler
Hello, i've got an utils library that i would like to :use everywhere (implicitly), what is the way to do so with leiningen?
@pbaille The simple answer is "you can't" -- and I'd say you really shouldn't even if you can figure out a way.
Clojure favors more explicit approaches -- which is why :use
is considered bad practice, along with :refer :all
.
@seancorfield thank you for your answer, i understand. even if sometimes, i have to admit that i'm tired to always rewrite mapvals or things like that... but it's ok 馃檪
also, i'm wondering what is the rational behind
(merge {:x 1} [:y 2]) ;=> {:x 1 :y 2}
?Well, Clojure often defines the behavior of a function only for certain types of input -- and other inputs may or may not given sensible output. Some people call that garbage-in, garbage-out. Others just call it undefined behavior 馃檪
It's part of what allows Clojure to be fast in the good cases.
merge
is defined on maps, only.
It's implemented in terms of conj
however, and that just happens to be able to add vector pairs or MapEntry objects into a map.
(sh "git" "clone" "[email protected]:clojure/clojure.git")
Why output is in :err? It seems like a bug in git command WDYT?i think it's related to the practice of outputting nothing on stdout when everything is successful
so then when you do git clone foo | baz bar
, it still prints its output to the console, rather than piping to the baz bar
command
馃槷 Had no idea that such practice exists. To conclude the errors will go to stdout
it's common in pretty much all of unix, although i think it's a matter of taste / style what to do in the case of git clone
@lmergen There are many Unix commands where errors go to stderr and 'normal' output go to stdout. I think the surprise here is that the no-error case output goes to stderr.
Looks like at least a few other people consider this odd behavior on the part of git that surprises them, although I guess it is now fairly well known and documented: https://stackoverflow.com/questions/37561240/why-does-git-submodule-add-write-to-stderr-rather-than-stdout
thanks to @lmergen now I know why I couldn't grep
the output of lein deps :tree
...although now I need an alias for this mouthful lein deps :tree 2>&1 >/dev/null | grep
馃槢
@joelsanchez On my MacOS machine, I can do lein deps :tree | grep foo
and get the filtered output. Your system doesn't?
@andy.fingerhut I'm on Linux, that might be it
My Ubuntu 18.04 VM also works without the extra piping trickery.
I think it is the git
commands specifically that have the unusual behavior of sending progress output to stderr