News for hackers. Stuff that matters.
Re:Python’s “type hints” are a bit of a disappointment to me by jve on Friday April 22, 2022 @08:54AM (#31121013)
> C# has done a better job of keeping up, in my opinion, but even it still lacks extremely useful features like proper Sum Types

Does type pattern matching comes close? https://dotnetfiddle.net/Oz2Qyd

Yeah, it doesn't prevent passing unexpected type as object to Print func and getting runtime exceptions. And returning "object" type isn't helpful if we want to prevent runtime errors. But then again, it can be written to spit out compile time errors: https://dotnetfiddle.net/XfKVaa

There are no comments on this comment yet.