While working on Clojurific, i came across this issue https://clojure.atlassian.net/browse/CLJS-2461 (and probably same https://clojure.atlassian.net/browse/CLJS-3426) which is marked as minor although it feels higher priority to me; there was a bug in our code caused by this (in this cased it happened when working on snake_case API responses). What exposed it for us was experimenting with switching from var to const in generated JS. Perhaps could be a good idea to consider for ClojureScript too?
hehe eventually everything gets written in rust it seems ... https://github.com/Smrtnyk/closure-rs
Squint uses const only for let bindings
Is this a known bug? str/replace docstring says replacement is literal for string / string:
> The replacement is literal (i.e. none of its characters are treated specially) for all cases above except pattern / string.
but the https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement are sneaking in:
ClojureScript 1.12.145
cljs.user=> (str/replace "foo-bar" "bar" "$&")
"foo-bar"
cljs.user=> (str/replace "foo-bar" "bar" (constantly "$&"))
"foo-$&"
Clojure 1.12.4
user=> (str/replace "foo-bar" "bar" "$&")
"foo-$&"
user=> (str/replace "foo-bar" "bar" (constantly "$&"))
Execution error (ClassCastException) at user/eval3 (REPL:1).
class clojure.core$constantly$fn__5761 cannot be cast to class java.lang.CharSequence (clojure.core$constantly$fn__5761 is in unnamed module of loader 'app'; java.lang.CharSequence is in module java.base of loader 'bootstrap')
(same issue in squint btw)I made this bug compatible at some point maybe :)
@shaunlebron probably we should just fix the docstring, this has to be very old behavior