Fork me on GitHub
#off-topic
<
2018-12-29
>
vemv21:12:55

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

hmaurer21:12:33

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)

vemv22:12:19

@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...

cjsauer22:12:12

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.

vemv22:12:04

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

cjsauer22:12:28

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.

vemv22:12:43

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

john22:12:19

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?

vemv22:12:33

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

john22:12:14

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

john22:12:42

would it be lowest common denominator or greatest common divisor?

4
john22:12:45

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

john22:12:02

But are composites abstractions over primes?