3 ms·
I used to debate this but after learning Rust it’s undeniable.
by almost_usual 4y ago
I used to debate this but after learning Rust it’s undeniable.
- ilikehurdles 4y agoI thought I wanted static typing until I started writing clojure.
- christophilus 4y agoClojure is the only dynamic language I’ve ever loved. It is in its own ballpark, really, though maybe Erlang or Elixir would win me over if I spent enough time with them.
- ilikehurdles 4y agoI’ve actually been spending the last year with elixir professionally. I’m embracing some of it… I would love to see its pattern matching and annotations come over to clojure, and would make my clojure code even more “correct.” I don’t super fully “get” all of its message passing plumbing, and I don’t like the quality of its library ecosystem. But clojure’s REPL, babashka, and clojure.spec are sorely missed.
- christophilus 4y agoFor me, after Clojure, I just get annoyed by every other language's special syntax.
- almost_usual 4y agoI’m not smart enough to program quickly and correctly in Clojure. I think it follows the same ethos Rich Hickey has about unit testing being “guard rail driven development”. I watched him talk about this a decade ago at Strange Loop. To understand your whole program all the time at scale is probably something Rich Hickey is capable of but I definitely am not.
- Spivak 4y agoWorking in a huge Ruby codebase, I know not the same, but still super super dynamic my approach is 1. If I don’t understand what code does just delete/noop it and see what tests fail. 2. Write my assumptions into new tests to be very loud people if someone wants to break them. Easier said then done with frameworks/callback patterns that want to call my code from god knows where but really powerful when you’re pulling a value. 3. In the case of callback spooky object at a distance stuff be strict about what you accept and fail loud.
- icambron 4y agoI 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.
- froderick 4y agoSame here. Clojure offers a bunch of different invariants than ‘this field is a string’. Things like ‘nobody is modifying this complex data structure out from underneath you’ or ‘this complex value is trivially printable, readable, inspectable, comparable, diffable, etc’. And if you want to know for sure that field will be a string, you can spec it and enforce it where it matters. And ignore it where it doesn’t.
- vnorilo 4y agoYes. Dynamic types, mutability and complex OOP types are the toxic mix. It is very hard to make large programs simple, but lisps are some of the best PLs for that, especially if you stick with immutable data.