Much of the trouble with trying to decide between structural and nominal typing is that the former describes what something *is*, and the latter describes what something *means*. Both have tradeoffs, and it seems fundamentally impossible to get the pros of both without the cons.
Conversation
Structural typing dramatically increases reuse and composition. The Clojure folks often take this to an extreme, and it makes some things seem effortless. But nominal typing increases safety and makes it possible to reason about things in a more abstract way.
1
1
16
It seems that one of the principal advantages of fancier type systems is that they allow structures to be more precisely described, helping to get more of the benefits of each without giving up so much. But even in such languages, it’s hard (impossible?) to completely escape.
1
8
I have an inkling that row polymorphism might get us pretty close to the best of both worlds
1
8
I agree that row polymorphism seems to be an enormous win in this department.
1
3
I do think that there are problems with the modularity of row polymorphism as commonly expressed. Using what are effectively type-level strings for labels is not enough - namespacing is important. See how clojure/spec uses namespaced symbols for an alternative.
1
3
I should be careful to soften that 'is not enough' comment though - it's more of a hunch than anything.
1
Would also be interested to whether GADTs and dependent records could be made to be row polymorphic. Seems like that would be challenging. Don't think I've seen any treatments anywhere. 🤔
Not sure what row poly is going to give you if already have dependent types.



