7 ms·
A type system that doesn't do anything? It has that, it's called comments. Before you try to tell me that it's somehow different, consider that the main thing a
by Turskarama 2y ago
A type system that doesn't do anything? It has that, it's called comments.
Before you try to tell me that it's somehow different, consider that the main thing a type system has to be for consistency is accurate. If they types aren't checked by a compiler or interpreter, then someone can change the way the variable is assigned or what the function will work with, and the annotation will just be wrong.
- maleldil 2y agoThe idea is to have gradual typing, like Python does. Most annotations in Python have no impact on runtime (e.g. parameter types aren't checked), but they are still valuable for external tools to perform type checking. A program with the wrong types will still run, but you will get type errors from the checker. One difference is that Python specifies the type system in PEPs (basically Python's RFCs), while OP didn't ask for that here. This would mean whatever tool is implemented would define the type system.
- Turskarama 2y agoOP did also say "They wouldn't even have to be specified", which is the big difference here needed for a type checker to actually use them over comments.