Excellent point! This is one strength of types that doesn't really have a good direct equivalent in dynamic languages like #Clojure. I still don't miss types, tho. Why? Here are some of my strategies for understanding code that I'm reading. 1/
I will run the code as part of understanding it. With full access to the runtime in the REPL, I can often answer the question "What is this called with?" by actually calling it and then looking at the data. 2/
It's data! With Clojure you don't usually pass opaque objects around. Everything is represented with data. Maps, sets, vectors, scalars. It is easily inspected, filtered, drilled down into. 3/
The Clojure core library is packed with functions that work on its data structures. The result is less custom code to understand (what does this method even do). Instead you'll see the same common building blocks that you're intimately familiar with. 4/
Since the core library is so rich, the code is usually smaller in bulk. Add to that pure functions working on immutable data structures, and there's an immense amount of complexity that is removed. 5/
Finally, if all of these things fail me, I fall back to the tests. The tests should give me at least an example or two of how this is supposed to work. But normally, that is not necessary. The small code, the transparent data, the live REPL, is plenty.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Some thoughts on why I do not miss type systems as a #Clojure developer. 1/
Type systems give you more security, in exchange for making your code more rigid. You "lock the code down" with types, and in return you get some guarantees. This is in my experience not a good trade-off. 2/
In many ways it is parallell to gaining security by deploying less often. Maybe the added time spent indeed reduces errors, but the reduction in flexibility and speed is not worth it. 3/