Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> How does programming with Clojure targeting multiple platforms (JVM, JS, CLR, LLVM, ...) work?

Each variant has its own file extension, e.g. .clj for JVM and .cljs for JS.

In case you're writing code that needs to work on multiple platforms, you put it in a .cljc file. Any of the code in these files that still needs to be different due to the platform choice is differentiated inline using a reader macro, which results in the different platform compilers getting a (slightly) different abstract syntax tree, so it is not too dissimilar from writing cross-platform code in other languages (just more convenient due to the Lisp style).





Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: