by eru · 2y ago · 0 comments
It's an interesting mix that you picked.
Rust shows that sum types are useful even outside of functional programming.
Just like Java (and others) have shown that garbage collection is useful even outside of functional programming; but functional programming was where GC was 'born'. Just like functional programming was where sum types were 'born'.
Incidentally, garbage collection was born with Lisp. And Lisp is arguably a functional programming language (or family of languages), that for the longest time didn't have sum types.
What we call functional programming is a grab bag of features and absence of some other features, but the exact contents vary over the decades. Even C++ got closures these days.. and that's how progress looks like!
We see similar developments for closures and support for first class functions in general.
And my sincere hope is that in the future, other features like sum-types and pattern matching over them will go the same way.
The functional programming community pioneered many of these features; but those features aren't restricted to that small corner of our industry.
I hope that relations-as-datatypes will see widespread use in the future. SQL shows that relations are good for expressing business logic, and I used them in a Haskell dialect as an internal datatype (unconnected from any database), and the experience was great.
There's no reason Python etc couldn't host relations as datatypes, the same way they already host dicts.