This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Is this a clojure / tools / build problem or should it be a linter problem? Happy to add support, but would be good to know before going in. https://github.com/clj-kondo/clj-kondo/issues/2006 (tl;dr: capitalized variations of the same name for different vars leads to problems on case-insensitive file systems)
It’s a known issue, but not one we plan to address in Clojure afaik. I would say don’t use two source files that are the same insensitive to case
Seems like some lib ran into this years ago, but maybe that was specifically with vars (which may become classes on disk at some point), maybe it was camel-snake-kebab?
https://github.com/clj-commons/camel-snake-kebab/issues/15 is the issue I’m remembering
I guess it's better to avoid it then, would it be good to make this a default linter (as opposed to opt-in)?
right, if anything, this should be solved at the level of the JVM, rather than clojure
I looked a bit deeper into this and when I compile a namespace like this:
(ns scratch)
(defn Foo1 [])
(defn FOO1 [] (Foo1))
I only see one scratch$Foo1.class
file and not a second scratch$FOO1.class
- is this expected? Maybe I'm doing something wrong.What kind of filesystem?
Mac is insensitive but preserving by default
So in checking the class on the second one it will look like it’s already there
So, this is the expected (confusing) behavior and the reason you should not do this :)
cool, I thought it was only a problem on Windows, but it seems there's even more reasons to avoid it :)
@UR1CCJ8MS implemented this linter and I'm finding various cases like this. E.g in transit-clj:
(deftype Reader [r])
(defn reader [])
also for writer
. In clojure core even for Eduction
and eduction
.
Has this ever caused problems for any people? If not, why not? It seems we need to tune down the linter in that case?For a full list of potentially false positives: https://github.com/clj-kondo/clj-kondo/pull/2009#issuecomment-1467764894
Ah the non-issue between deftype Reader
and defn reader
is that reader
is emitted as classes/scratch/reader.class
but Reader
is emitted as classes/scratch/scratch/Reader.class
, so no conflict
OK, so it looks like we should consider definterface
, defprotocol
, defrecord
and deftype
as one set of names, and defn
, defn-
, definline
and defmacro
as another set, and look for conflicts within each set but not between them?