I've been trying to work out why this is, but I've not got a good answer so I thought I'd ask here, why does defonce not accept an optional docstring?
No good reason. We have an old ticket about it, fixing it is surprisingly more subtle than expected
You can vote for it here https://ask.clojure.org/index.php/2769/adds-docstring-support-to-defonce?show=2769#q2769
@folcon you can still do this:
user=> (defonce ^{:doc "dude"} foo 1)
#'user/foo
user=> (doc foo)
-------------------------
user/foo
dudeAhh, thanks @borkdude!
Hmm can you evaluate that twice and see if the docstring is still there? That might be the caveat, havenβt tried
user=> (defonce ^{:doc "first"} foo "one")
#'user/foo
user=> foo
"one"
user=> (doc foo)
-------------------------
user/foo
first
nil
user=> (defonce ^{:doc "second"} foo "two")
nil
user=> foo
"one"
user=> (doc foo)
-------------------------
user/foo
second
nil
So the metadata is updated by invoking it again even tho' the value is not.ok, but as long as the same expression can be evaluated multiple times, the docstring will stay in place so that's good I guess.
user=> (defonce ^{:doc "dude"} foo 1)
#'user/foo
user=> (doc foo)
-------------------------
user/foo
dude
nil
user=> (defonce ^{:doc "dude"} foo 1)
nil
user=> (doc foo)
-------------------------
user/foo
dudeThis is very niche, possibly not the right place, and probably talking into the wind π
, but:
The https://clojure.org/guides/install_clojure#_posix_instructions, posix-install.sh, seems to assume bash even though the shebang declares generic #!/usr/bin/sh. On SmartOS (an illumos/Solaris derviative) the local sh is Korn Shell (`ksh93`), which seems to trip over the use of local in do-install (I am guessing it tries to use the local localwhich is for mail delivery via Postfix).
Changing the shebang line to be explicitly #!/usr/bin/bash fixes this and it works fine (with a --prefix).
I realize smartOS isn't explicitly supported by this script, but on the other hand, since bash is listed as a prerequisite, I wonder if there is any reason to not just put bash in the shebang.
Just my .02 π
I wonder if the Linux script would just work https://github.com/clojure/brew-install/blob/1.12.3/src/main/resources/clojure/install/linux-install.sh I forget if the -e option to sed is a gnu'ism
local is not technically in POSIX but basically every shell script assumes it because both ash (busybox) and dash (debian) support it
https://news.ycombinator.com/item?id=45767725 immutable talk πΏ
funnily enough, John's advice also good advice on clojure: don't shadow bindings π