| ▲ | dnautics 4 hours ago | ||||||||||||||||||||||||||||
I think this is wrong. Type systems should be simpler, and you should design it so that your language is easily and correctly statically checked. Not all invariants necessarily have to be verified at the same cadence (compile time) | |||||||||||||||||||||||||||||
| ▲ | treyd 3 hours ago | parent | next [-] | ||||||||||||||||||||||||||||
> you should design it so that your language is easily and correctly statically checked. You do that by making the type system more sophisticated. If you have a really important invariant that you really don't want to be violated due to run-time behavior/input, it's a huge benefit to have a compiler that can statically check that it actually can't be. That's one of the main benefits of having type systems, not just describing the shape of data structures in memory. | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ▲ | AnimalMuppet 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
But what does static analysis work on? The source code. If it's not in the source code, the static analyzer can't check it. So if you want to check something, even with a static analyzer, then you need some way to talk about that thing in the source code, which means it has to be part of the source language. Now, sure, you could have some kind of annotations in the comments or something, and a static analyzer that checked those, and you could get that to check pretty much anything that can be checked statically. But at that point, it's not really part of the language, is it? | |||||||||||||||||||||||||||||
| ▲ | classified 3 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||
So you prefer runtime crashes to compiler diagnostics, just so the type system can be "simpler"? I find these priorities backwards. | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||