You can start with a minimally irreducible set of forms, and then grow the compiler itself like a seed
Yeah I wonder if it can be somehow designed where there is a base implementation in mini-Clojure, and then parts are incrementally rewritten in the host as-needed.
You can trace the call graph and eliminate namespaces/functions that aren't referenced anywhere
If you end up making a tool like that, then it seems it could be host-agnostic. I guess it should be doable to trace a program run and then extract which namespaces are used.
I guess on the JVM that should be possible as well (maybe even easier in some way). I've tried ProGuard in the past but I never got it working with Clojure code.
Thanks for your thoughts! Excited to watch what you end up doing next :))
A portable mini-Clojure would definitely be neat. SCI already kind of does this with an interpreted version, but actually having a compiler that's easy to plug into different runtimes would be handy as well.
And I'll definitely blog about the findings with the tree shaking idea. Might run into some blockers I haven't considered yet, but I'll learn something one way or the other here. :)
View all comments
Show parent comment
1
u/geokon Jun 29 '26
Yeah I wonder if it can be somehow designed where there is a base implementation in mini-Clojure, and then parts are incrementally rewritten in the host as-needed.
If you end up making a tool like that, then it seems it could be host-agnostic. I guess it should be doable to trace a program run and then extract which namespaces are used.
I guess on the JVM that should be possible as well (maybe even easier in some way). I've tried ProGuard in the past but I never got it working with Clojure code.
Thanks for your thoughts! Excited to watch what you end up doing next :))