3 ms·
"The type system is what the compiler (or interpreter) knows about your program." Compilers know a lot more than just what is represented in "the type system"
by dllthomas 13y ago
"The type system is what the compiler (or interpreter) knows about your program."
Compilers know a lot more than just what is represented in "the type system" (as it's typically thought of, anyway). Control flow (basic block analysis, &c) for instance. Which isn't really taking away from your larger point - certainly, things represented in the type system are things the compiler will know about.
"Whenever you find yourself writing an assert method, take a beat and figure out if the type system could have turned that into a compilation error instead."
Possibly with a _Static_assert (or static_assert) as if C11 (/C++11)! Obviously there are substantial limitations still, but it's great to be able to pull more to compile time cleanly.