4 ms·
> If C# and Go preclude 95% of the errors found in Python and JS Well Go and C#[1] still suffer from the billion dollar mistake (null pointers), which represen
by littlestymaar 6y ago
> If C# and Go preclude 95% of the errors found in Python and JS
Well Go and C#[1] still suffer from the billion dollar mistake (null pointers), which represents at least 1/3 of errors I've witnessed in JavaScript code, so I'd say they at best removes 70% of errors. And there's also logic errors, for which neither Go's or C#'s type system helps either, so maybe we're at 50% error reductions with Go and C# compared to JS and Python. I don't even think that Rust, with its really helpfull type system (ADT + Affine types) achieves 95% error reductions though.
[1]: for C#, at least last time I used it, which was 2011
- roca 6y agoNewtypes are also pretty great for detecting logic errors. (You can use them in Go and C# but they're not idiomatic and usually not zero-cost so people usually don't.)
- throwaway894345 6y agoNewtypes are pretty idiomatic in Go (e.g., https://golang.org/src/os/types.go#L35 https://golang.org/src/os/types.go#L35), and they're so inexpensive that cost isn't a reason to forego them 99% of the time.
- roca 6y agoSorry, my mistake, thanks for the correction.
- pjmlp 6y agoBesides the sibling answer about Go, when you are in .NET world there are also F# and C++/CLI to chose from, so C# doesn't stand alone (leaving VB.NET out as it appeals other kind of developers).
- Hawxy 6y ago> for C#, at least last time I used it, which was 2011 Since then, C# added nullable reference types: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types https://docs.microsoft.com/en-us/dotnet/csharp/language-refe... In projects with complete NRT coverage, it's extremely rare I ever get a null ref, as the compiler will warn/error me if I'm using a possibly null value in an unsafe way.
- littlestymaar 6y agoThanks. I suspected it since they added them to TypeScript, and I'm glad they did!