3 ms·
Unlike in C# pattern matching in F# is exhaustive. I’m guessing this is what was meant by “better”.
by konamicode 7y ago
Unlike in C# pattern matching in F# is exhaustive. I’m guessing this is what was meant by “better”.
- throwawa66 7y agoYes, i find that a good argument especially if you plan on using this feature a lot it can save you from shooting yourself in the foot. It also is a better idiom in F#, nicer to grok, but that’s subjective. However, only direct experience will make you reconsider. I’ve seen a discriminated union implementation in C# the other day and was repulsed.
- DaiPlusPlus 7y agoI use OneOf<T...> in C# a lot now. If you’re thinking of the same one I am the only ugly thing about it is the code-generation required to generate all of the variations from OneOf<T0,T1> to OneOf<T0,T1,T2,T3,T4,T5,T6>.