This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-03
Channels
- # announcements (35)
- # aws (20)
- # babashka (4)
- # beginners (88)
- # cider (9)
- # clara (1)
- # clj-kondo (6)
- # cljsrn (3)
- # clojure (107)
- # clojure-dev (7)
- # clojure-europe (99)
- # clojure-nl (3)
- # clojure-spec (9)
- # clojure-uk (2)
- # clojurescript (28)
- # core-async (53)
- # cursive (11)
- # datascript (1)
- # datomic (2)
- # emacs (20)
- # fulcro (3)
- # graalvm (4)
- # holy-lambda (18)
- # jobs (1)
- # kaocha (7)
- # leiningen (2)
- # lsp (25)
- # luminus (1)
- # membrane-term (52)
- # missionary (8)
- # nextjournal (19)
- # off-topic (16)
- # other-languages (3)
- # podcasts-discuss (2)
- # polylith (23)
- # re-frame (4)
- # reclojure (6)
- # remote-jobs (1)
- # rewrite-clj (36)
- # ring (1)
- # sci (10)
- # shadow-cljs (7)
- # spacemacs (5)
- # sql (20)
- # uncomplicate (1)
- # vscode (3)
- # xtdb (27)
I often see requests for a way to set *warn-on-reflection*
true globally and, looking through the Clojure source, I see there's a clojure.compile.warn-on-reflection
JVM option but it only seems to apply to clojure.lang.Compile/main
. Is there a specific reason why there's no global way to set that variable? I seem to recall Leiningen has a way to set "globals" but that's just for the context of anything it executes (so binding
works in that situation). I know you can do this for a REPL with it set "globally":
clj -M -e '(set! *warn-on-reflection* true)' -r
but that doesn't work if you're trying to use aliases that contain :main-opts
since they don't combine.I don't think there's a good reason this doesn't exist, it's an artifact of history. there is perhaps a thought process that it is only useful during compilation, and compilation is only the "only" job when running the (fairly obscure) Compile program. (Compile is primarily used for building Clojure itself.) I don't think that thought process matches today's reality.
I don't think this is any conceptually different than other compiler system properties https://clojure.org/reference/compilation#_compiler_options
and it would make sense to have it
https://ask.clojure.org/index.php/3787/theres-enable-warn-reflection-from-command-running-clojure is a time when you previously asked this question :)