This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-05
Channels
- # 100-days-of-code (1)
- # announcements (9)
- # aws (1)
- # beginners (195)
- # braveandtrue (60)
- # calva (3)
- # cider (36)
- # cljs-dev (3)
- # clojure (124)
- # clojure-canada (13)
- # clojure-dev (18)
- # clojure-germany (2)
- # clojure-italy (2)
- # clojure-losangeles (1)
- # clojure-nl (9)
- # clojure-russia (1)
- # clojure-spec (20)
- # clojure-uk (109)
- # clojurescript (49)
- # core-logic (29)
- # cursive (7)
- # datomic (62)
- # defnpodcast (1)
- # devcards (11)
- # docker (3)
- # duct (6)
- # figwheel (13)
- # figwheel-main (57)
- # fulcro (2)
- # graphql (11)
- # hyperfiddle (3)
- # jobs (5)
- # jobs-discuss (9)
- # leiningen (2)
- # lumo (1)
- # off-topic (12)
- # onyx (2)
- # pedestal (1)
- # portkey (2)
- # rdf (1)
- # re-frame (39)
- # reitit (13)
- # remote-jobs (2)
- # rum (5)
- # shadow-cljs (82)
- # tools-deps (48)
- # unrepl (3)
- # vim (12)
- # yada (1)
I had an issue where I had two functions in a file, replace-_
and replace_-
. This worked in dev, but when I aot the project, any invocation of either is replaced by the last one in the file. I suppose this is because munge
gives the same result for both those names. Is this a known issue?
"known" as in "there's a JIRA ticket because it's a bug"? or as in "yes, munge produces the same JVM-level name for both because that's just how it works"? 🙂
I don't remember anyone specifically mentioning it as a problem -- but I don't know whether the behavior of munge
is documented anywhere in a way that would make the possibility of collisions obvious...
@madstap I assume your functions are related to converting names between kebab-case and snake_case?
Yeah, I'd say it's worth opening a JIRA ticket to add a compilation warning about name-munging producing collisions...
@the2bears The clojure names of the fns are foo.common.core/replace-_
(and replace_-
). The class in the jar is /foo/common/core$replace__.class
I could be wrong, but it isn't clear to me whether there is a straightforward way for the compiler to detect that name-munging produces collisions. I say that because there is no warning, and likely never will be, if you defn the same function name multiple times (same even before the name is munged). Detecting that was one of the motivating use cases for me hacking on Eastwood for a while.
Clojure has no warning for that because it is such a common use case in REPL workflows to redefine functions.
But perhaps in the specific case of 'during aot compilation' it might be straightforward to detect when writing a .class file that already exists.
@madstap What version of Clojure are you using? This behavior might be better with Clojure 1.9 than in Clojure 1.8.
Never mind on my last comment -- I think I confused myself with some test expressions I was evaluating.
No promises on whether Eastwood ever will have such a check, but I've created a Github issue for it in case someone decides to run with the idea and implement it: https://github.com/jonase/eastwood/issues/281