3 ms·
It's there with nil to begin with. A Maybe type without pattern matching is basically nil checking. Now if he had said I want some kind of pattern matching then
by dkarapetyan 12y ago
It's there with nil to begin with. A Maybe type without pattern matching is basically nil checking. Now if he had said I want some kind of pattern matching then I would get behind that.
- codygman 12y agoSo you would prefer a language without sum types but with pattern matching and exhaustiveness checking for nil then?
- dkarapetyan 12y agoNot what I said and I don't see why you make those choices mutually exclusive. You can have pattern matching without sum types and you can have sum types without pattern matching. In fact Ruby's case/when statement is very limited form of pattern matching that can be put to great use with proper use of Structs and overloading of ===.
- masklinn 12y agoErlang is probably a better example of pattern matching (complete) without formal sum types (though dialyzer has value and type alternatives)