3 ms·
I'd say this is probably a bad example of usage for the feature. I use pattern matching in a few places in my own code-base, and it's almost always on interface
by moron4hire 7y ago
I'd say this is probably a bad example of usage for the feature. I use pattern matching in a few places in my own code-base, and it's almost always on interfaces that have a large set of extension methods applied. It's kind of like an entity-component architecture, except the components are added at compile-time, rather than run-time.
Unfortunately, real-life use scenarios are verbose and involved and require a lot of background context that detracts from just demonstrating the syntax. This is just demonstrating the syntax. Standard patterns of software design still apply.
- bernawil 7y agoI personally hate when official documentation uses badly applied approaches because it will be invariably be quoted as source for some "best practices" argument at some point. That's clearly a use case for interfaces and type-level programming. They could have made a better and shorter case with error handling logic.
- moron4hire 7y agoOh, I hate the phrase "best practices" in general. Reeks of cargo-culting.