4 ms·
I occasionally missed types even in Clojure. “What keys are supposed to be in this map again? Hmm, turns out some callers are providing foo and some are providi
by icambron 4y ago
I occasionally missed types even in Clojure. “What keys are supposed to be in this map again? Hmm, turns out some callers are providing foo and some are providing bar…”
That said, I certainly agree it comes up less than it does in, say, JavaScript
- ilikehurdles 4y agoI agree. In another comment I mentioned how I think Elixir’s pattern matching and annotations (type specs) would take clojure to that next level and strike a perfect balance between between ergonomics and correctness.
- icambron 4y agoClojure has a few options here. Typed Clojure is a set of macros for enforcing typing, conceptually similar to Typescript (and like Typescript, I found it hard to incrementally retrofit in a large existing project), and core.spec, which is a way of declaring DSTs validations, which I found useful without cramping the Clojureness too much. But it’s been a few years
- robertfw 4y agothis is why I love spec (though I am starting to explore replacing it with malli)
- froderick 4y agoWe’ve been moving steadily to malli over the last 6 months. I have to say, programmatically composing malli schemas as values (rather than macros) is really powerful. I like being able to define a base set of fields on a map, and then merge in other schemas and different sets of fields that are required in different cases. Nice for modeling apis with reused structures but with varying field requirements.