News for hackers. Stuff that matters.
Re:Who cares about functional programming? by platz on Monday September 23, 2019 @12:21PM (#21050370)
unfortunately C# pattern matching is really only a glorified switch with destructuring that doesn't provide any level of exhaustiveness checking that is very helpful in maintaining code under conditions of change.
Re:Who cares about functional programming? by thelazydogsback on Monday September 23, 2019 @12:32PM (#21050493)
Agreed. Even w/o DU's/sum-types/case-classes, there could be a compiler option when matching an instance against a lists of sub-classes that a warning/error is generated if the list of sub-classes does not fully cover the parent class. (It should be fairly easy to write a Rosyln-based plug-in that enforces this.) Typescript allows you to express this kind of thing pretty well -- maybe some of that work will end up migrating to C#. F# used to be the C# feature playground, but that's probably changing now. Not sure if TypeProviders will ever make it...
Re:Who cares about functional programming? by platz on Monday September 23, 2019 @12:37PM (#21050559)
TP's I don't think have quite borne out the usefullness-to-complexity ratio
Re:Who cares about functional programming? by thelazydogsback on Monday September 23, 2019 @12:55PM (#21050773)
Agreed, but anything is better than some 3rd-party tool (that may or may not be integrated into the build) doing one-off ad-hoc code generation. I think any C# meta-programming facility would be a good step. Certainly the TP interface(s) could be simplified for C#.
Re:Who cares about functional programming? by platz on Monday September 23, 2019 @01:20PM (#21051059)
well there are T4 templates for C# code-gen, although I can't say I've ever been eager to use them.