logoalt Hacker News

jimbokuntoday at 6:16 PM2 repliesview on HN

This is really the kind of thing you want to fail at compile time which isn’t real possible in a dynamic language like Clojure.


Replies

slifintoday at 6:55 PM

Well it is possible - you can add a user macro that calls into clj-kondo (or anything actually) to check your codebase on compile

It just doesn't make much sense to do - most modern developers will be running static analysers through LSP or their editor (knowingly or not) continuously on code change so as to see those errors quicker than re-compiling the program

xoxoliantoday at 6:53 PM

Unless you use Typed Clojure, which is a library. https://github.com/typedclojure/typedclojure

I haven't used it, so I don't know its tradeoffs; but its docs say its types exist at compile time: https://github.com/clojure/core.typed/wiki/User-Guide