This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-29
Channels
- # beginners (29)
- # boot (17)
- # calva (1)
- # cider (31)
- # cljs-dev (3)
- # clojure (169)
- # clojure-europe (1)
- # clojure-france (1)
- # clojure-russia (40)
- # clojure-serbia (3)
- # clojure-uk (42)
- # clojurescript (19)
- # clr (3)
- # core-async (7)
- # core-typed (3)
- # cursive (43)
- # datascript (4)
- # datomic (2)
- # dirac (4)
- # emacs (2)
- # fulcro (85)
- # funcool (1)
- # nrepl (5)
- # off-topic (14)
- # shadow-cljs (28)
- # spacemacs (5)
- # tools-deps (2)
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.
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 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