3 ms·
There are type systems out there that allow you to model more than "is a string, is a float, is an int". There are CVEs for use-after-free bugs in Firefox, IE,
by pdpi 6y ago
There are type systems out there that allow you to model more than "is a string, is a float, is an int".
There are CVEs for use-after-free bugs in Firefox, IE, the Linux kernel and more. Rust's type system helps prevent those. There are CVEs for double-free bugs in OpenSSH, OpenSSL, and Kerberos. Again, Rust's type system helps prevent those. There are CVEs for null dereferencing in the Linux kernel, CUPS, and OpenSSL. Many languages have type systems that help preventing those.
There's many more classes of bugs that can be prevented by judicious use of robust type systems. Dismissing strong, static typing as "a crutch for bad programmers" is just plain wrong.
All of this, of course, assumes the only use for static types is preventing issues. Algebraic data types actually allow you to write simpler, more concise code in languages that support them. Typeclasses make for a whole model of polymorphism that's just incredibly painful to implement in languages that don't support them.
- AnimalMuppet 6y ago> Dismissing strong, static typing as "a crutch for bad programmers" is just plain wrong. No, it's correct. The problem is that innocentoldguy doesn't realize that he is a bad programmer. (That's not an attack on him - we all are bad programmers.) So here we are, bad programmers. Here's this crutch - or, less negatively put, here's a tool that can help. Maybe we can be somewhat better bad programmers if we use it.
- pdpi 6y agoI get your point, but if we're all bad then "bad" loses its meaning. I'm definitely a better programmer than many of my peers, and worse than a whole bunch of others.
- AnimalMuppet 6y agoWe're bad, not in comparison with each other, but in comparison to the external standard of "good enough that we don't need a crutch". In fact, if you want to be a better (less bad) programmer, learn to use the available crutches more effectively.
- eru 6y agoWell, it's a bit like saying that computers of the electronic kind are a crutch for bad computers of the human kind. Or that planes are a crutch for bad travelers who can't fly under their own power.