r/Clojure • • Aug 13 '25

Pure Clojure and Host Platform InterOp

Clojure is a hosted language and accessing host platform libraries from within Clojure through InterOp helps in reusability. However now that Clojure has been hosted on JVM, JavaScript Engine, .NET, LLVM, etc. I think that developing a pure Clojure implementation that can be reused as it is on different host platforms should also be a code development goal. But it seems InterOp and cross-hosting are two conflicting goals. So what might be the strategies one should follow to optimise between these two?

Looking forward to insights from Clojurians here.

14 Upvotes

11 comments sorted by

View all comments

Show parent comment

3

u/daveliepmann Aug 13 '25

Pure Clojure libraries can be cool and make porting to another host easier. At the same time it's an additional constraint that in some situations can be quite limiting.

For nitty-gritty tactics of supporting multiple hosts, one approach is described in the CLJC part of Lambda Island's style guide. "Use a platform namespace" might be relevant.

1

u/Alarmed-Skill7678 Aug 13 '25

Thanks for the reference. Let me go through this.