4 ms·
I'm wondering why the C# team is so keen on pattern matching - I feel like multiple dispatch would suit the language more and accomplish much the same thing. Bu
by lacampbell 10y ago
I'm wondering why the C# team is so keen on pattern matching - I feel like multiple dispatch would suit the language more and accomplish much the same thing. But C# is a weird beast in some ways - a pure OO language that keeps introducing features to make writing getters and setters more and more convenient.
Maybe I just need to move on with the times. I still see a lot of value in OO, but it's clear it's not at all in vogue. I am glad that functional ideas - particularly immutable data, and anonymous functions - have come into the mainstream. But I don't feel the need to throw the baby out with the bath water.
- dualogy 10y ago> I'm wondering why the C# team is so keen on pattern matching It's kind of a pre-condition (though not in the current initial limited variation) for the introduction of Algebraic Data Types (as F# & co. have them), which I'd still be missing in C# if I had to get working on a C# codebase (might happen again soon, I just don't get any Haskell enquiries in my freelance channels =)
- lacampbell 10y agoWith multiple dispatch, you could already use the existing way of having sum types - class hierarchies - without introducing a second kind. I just don't see why you want both inheritance and ADTs in the same language. But it's entirely possible I'm missing something, I'm an amateur PLT enthusiast at best.
- dualogy 10y agoWould just be syntactic sugar anyway, F# surely compiles its ADTs and parametric polymorphism down to something supported in MSIL bytecode.. but potentially powerfully productive "sugar", any highly expressive language is 80-90% sugar (just the right kind) over a much smaller intermediate core language of way fewer actual primitives