Is a '.close()' method being called twice a type error? It is in a language that can express states in the type system.
Is SQL injection a type error? It is when you use refined types in your sql library interface.
The vast, vast majority of errors I run into are errors that, with effort and the right type system, I could turn into type errors.
The point being that asking "would those be type errors?" is a really big question that is, when answered simply, "yes".
Pyflakes and unit tests will detect the great majority of potential errors. Mypy gets you closer to zero.
No, it's a pragmatic argument. There's no circularity it.
If they're not mainstream, then they're neither "very usable" or "well-supported" to any extend that a mainstream language would be.
- There are no mainstream languages with powerful and convenient type systems
- But there are less mainstream ones
- But I won't use those
- There are no mainstream languages with powerful and convenient type systems
That's however a totally legitimate engineering choice.
Engineers picking on a language shouldn't bet on less mainstream incomplete environments with less tooling and libs and options and devs, just so that they can raise them into the mainstream.
That might be a "tragedy of the commons" thing, but it's not an engineering obligation to be an early adopter.
> There aren't any mainstream languages that have the ability to detect the ultra high-level errors you describe.
And it's like, well there are great languages that can do that, but if you restrict yourself to that tiny 'mainstream' subset, you'll never know it.
And moreover I think engineers (or rather, companies) are way too conservative about this stuff–picking 'mainstream' tech can be a touch-and-go proposition at any time. Just because something is mainstream, doesn't mean it's the right choice for your project.
Injections are handled by any language with taint, although that became less popular. Perl had it. Anything with typed orm also has something similar (for example Esqueleto in Haskell)
As for closing resources, you can use a pattern such as using(open("file.txt"), (f) => { ... }) if your language doesn't already support such a construct.
Sure, no one should need to do that anymore, it's just an example. There are many other cases that are similar, however.
`using` is a language construct, not something that is part of an interface. It also does not prevent close from being called twice.
It's when you want to add features to a codebase you don't understand, when these features shine.
Have you written and deployed production code in the languages you mention above? Did you encounter a substantial number of type errors?