This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-14
Channels
- # ai (24)
- # announcements (36)
- # babashka (15)
- # babashka-sci-dev (8)
- # beginners (18)
- # biff (4)
- # calva (24)
- # cider (13)
- # clj-kondo (1)
- # clj-on-windows (2)
- # clojars (15)
- # clojure (120)
- # clojure-dev (13)
- # clojure-europe (69)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (2)
- # clojurescript (4)
- # core-logic (2)
- # cursive (6)
- # datomic (193)
- # dev-tooling (4)
- # emacs (1)
- # hyperfiddle (57)
- # lsp (56)
- # malli (11)
- # missionary (15)
- # nbb (61)
- # off-topic (8)
- # polylith (8)
- # practicalli (2)
- # proletarian (1)
- # reitit (3)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (13)
- # spacemacs (1)
- # specter (2)
- # sql (17)
- # tools-deps (3)
- # vim (38)
I'm looking at clojure.main
and it seems that *repl*
is bound to true
in with-bindings
, which is used for all :main-opts
style invocations, I think? So add-lib
is available in any process started with -M
-- so -m some.ns
, -e some.expr
, etc all get *repl* true
and can use add-lib
.
This seems necessary for use with nREPL/CIDER etc -- and thus it works with my :dev/repl
code (that is invoked via -e
and requiring-resolve
) which is great -- but I just wanted to highlight that it's not "just in a REPL" in the bare clj
sense.
That also means that any (uber) JAR started via java -cp the.jar clojure.main -m my.entry.point
will also have *repl* true
I think and therefore could use add-lib
?
yeah, that should have been more scoped
what about just removing this var and just add warnings to the docstrings of clojure.repl/add-lib etc (clojure.repl already indicates that it's for REPL use only)
that was another option considered, we chose this
The trouble is, to make this work for most IDEs/editors, it really has to be available with -m
because that's how "everyone" starts REPLs these days. Unless all of that tooling is updated to bind clojure.core/*repl*
to true
-- and we know how slow that tooling has been to adopt all of the other work around clojure.main
such as exception/stacktrace handling 😞
I think, perhaps, a JVM property that turns it off might be sufficient to address people's concerns?
(I just posted a similar thought to Ask, but about disabling user.clj
auto-loading since that seems to bite people a lot -- and in fact bit someone trying out add-lib
today because invoke-tool
still caused user.clj
to get loaded, and it output stuff that broke the add-lib
function somehow)
Anyways, this is why we have Alphas 🙂
> That also means that any (uber) JAR started via java -cp the.jar clojure.main -m my.entry.point
will also have *repl* true
I think and therefore could use add-lib
?
I was wrong about this: although such usage would have *repl*
bound to true
, starting the process via java
means that the basis is not available and these features also assume they can shell out to the clojure
command on the host -- so all of this new functionality is only available in processes started via the Clojure CLI itself, not via java
.