Fork me on GitHub

Is there a strong reason not to author every Clojure file under the .cljc extension, regardless of its contents? i.e. I have a JVM-only project, but I'd go for .cljc always, because one never knows when one will want cljs support The points being, a) renames are ugly, b) having 3 extensions is ugly


I guess the implicit assumption of a .cljc file is that the clojure code it contains can be compiled both to JVM bytecode and to javascript, which isn’t the case if your project is JVM-only (or uses any JVM-specific features)


@hmaurer I see! yeah, it can be misleading to create a cljc file that can only compile to one target. Bit of a tradeoff Probably in practice though, consumers of a project precisely know whether that project targets jvm and/or js, so the info conveyed by the .cljc extension becomes less relevant...


As a library consumer, I can say that I’d be unpleasantly surprised to come across a cljc file that failed to compile on both platforms.


But one assesses README and project.clj files when evaluating a project, not .clj* files right? e.g. I don't confidently grab random clojure projects for my cljs projects - they might not be compatible In any case I can concede that point


I suppose it depends on the library. I very often dig into source files, and the file extension is a good indication of what I can expect from the code.


:thumbsup: for a library I might add a README note for preventing surprises


well, interestingly, some future host may exist which cljc can target with #?(:whatever and any given cljc file may be broken relative to that future target, right?


right, in a way all .cljc files are broken... for the CLR 🙂


right exactly... The lowest common denominator between CLJ and CLJS is a probably a good general target, but it'd be nice to have more diverse targets, in order to get a more robust lowest common denominator


would it be lowest common denominator or greatest common divisor?


I guess if you thought of composites as abstractions over primes, then GCDs would be like "higher level" abstractions over LCDs


But are composites abstractions over primes?