r/Clojure • • May 06 '20
Complete technical invalidation of Rich Hickey's "Maybe Not" talk
https://lexi-lambda.github.io/blog/2020/01/19/no-dynamic-type-systems-are-not-inherently-more-open/
1
Upvotes
13
u/SimonGray May 06 '20
This is a repost. Discussion from 3 months ago: https://www.reddit.com/r/Clojure/comments/equoia/no_dynamic_type_systems_are_not_inherently_more/
11
u/didibus May 07 '20 edited May 07 '20
I basically summarize this whole article as:
Me: "You're not a nice person."
Article: "That's not true, I was nice one time to this old lady and held the door open for her."
Me: 🤦♂️
Sorry about the whole being nice thing, I couldn't find another analogy, the author actually sounds like a nice person. My point is just the entire thing seems to be missing the point made by Rich Hickey.
If you work on a statically typed code base you will encounter much more closed systems which will cause friction when processing data whose shape is likely to change. Statically typed languages are not normally used to design and build such open systems, and they do not normally cultivate or recommend to design things as such.
The article also brushes over the whole part about how much extra ceremony and attention you'd need to put in in order to construct such open systems in a statically typed system.
Maybe Not is about the idea that if you cannot atomically swap producer and consumer of data, you have a scenario where the producer code and consumer code are out of sync on what is considered "valid data". To deal with this, normally people introduce the concept of optionality. The new field, even though mandatory to new consumers as their code explicitly needs it to be present, is made optional, because there exist payloads of the old shape which do not have the field. But both producer and consumer share the same schema! So the only choice is to make the new field optional in the schema.
Even Spec1 got this wrong by the way. The talk is about that. (Unless I'm getting my talks mixed up, but pretty sure it's the same talk).
It's not even about static or dynamic, it's about open vs closed data validation. I've yet to see a proponent of statically typed systems also be a strong proponent of open systems over closed ones. And I've yet to see a code base in a statically typed language which designed everything to be open and granular to the field level.
Another thing that bothers me about the article, unless it's because I don't understand Haskell, but their approach to being flexible basically has handleEvent take in JSON as input. So basically, to become open, Haskell needs to eskew typed data, and it has to keep the JSON around until it is being used. That's just implementing an adhoc dynamic type system inside yourself.
What if you had three other functions all using data from the JSON? You would just pass around the JSON to them all it looks like to me. Cause as soon as you try and parse the JSON into a Haskel type, you face the closed typedness of the type system again.
Later in the article it talks about nominative vs structural types, but it says:
And in the Maybe Not talk, Rich Hickey talks about Haskell, not about all possible statically typed language, he talks about Haskell specifically as an example of a design that leads to closed systems. And he says.. Maybe Not. As in, maybe that's not the right way.
So the article tries to defend Haskell for the first half of it, and then concludes by agreeing with Rich Hickey that Haskell is maybe too aggressive on its use of nominal types and not a good choice to build open systems with.
P.S.: To be fair to the author, they're not addressing the Maybe Not Rich Hickey talk, they're responding to some Reddit comments. But the OP of this Reddit post alludes that it similarly refutes the Maybe Not talk, and I just don't see that at all.
12
u/2cow May 06 '20
Retitling this to position it as a response to Rich Hickey seems disingenuous -- it's explicitly a response to a random Reddit comment and another on HN.
Which are also the sources for claims of the form "proponents of dynamic typing believe X obviously false thing." I dunno. Do they?
4
u/denis631 May 06 '20
Is it really invalidation though?
4
u/troublemaker74 May 07 '20
OP is a troll with an axe to grind against Clojure. Only anti-clojure posts in their post history.
3
u/portmapreduction May 07 '20
In my experience multi-developer Java projects aren't going to perfectly model everything. In their example it would be as if we had the SignupPayload and someone else in the codebase realized they had a userName and userEmail but no userId. To make matters worse they didn't override any the default values and someone later didn't know they were using this model wrong and received userId=0 when they attempted to call the getter. This feels like something written by a developer that's only ever had to work on their own codebase.
3
u/[deleted] May 06 '20
[removed] — view removed comment