|
|
|
|
|
by ValentinA23
557 days ago
|
|
Something I find problematic about the various implementations of Clojure is the lack of specs to determine a common ground. Clojurescript doesn't use the same conventions in import/require statements: you're supposed to import macros using :require-macros or :refer-macros (I'm not even sure anymore). Conversely, `:refer :all` was banned in a prescriptivist attempt at fixing Clojure "mistakes", the rationale behind this decision being that with `:refer :all` it's not always obvious what namespace required symbols come from. Yet, with a REPL or a language server, it's very easy to get that info. The point I want to make is that because of this porting Clojure code to Clojurescript implies a lot of inessential changes to the ns forms in your project. E.g: https://github.com/kachayev/muse/blob/8db4d5de82a8acccb4486c..., but I've done far worse. It doesn't need to be that way. |
|
A workaround is using Reader Conditionals (https://clojure.org/reference/reader#_reader_conditionals) and specifying platform differences where they matter, but it's awkward to say the least. What most projects do is to separate "common" namespaces and use the `.cljc` extension to indicate they're multi platform, and keep platform specific things in namespaces with `.clj`, `.cljs`, etc.