15 ms·
I understand that errors in type hints are bugs just like errors in code are. That's the problem. The entire point of type systems is to enforce correctness. T
by DasIch 11y ago
I understand that errors in type hints are bugs just like errors in code are. That's the problem.
The entire point of type systems is to enforce correctness. They allow you to describe problems on the type level and ensure that the code being described matches that description, eliminating certain classes of bugs. That's why languages have them, that's the expectation.
Type hints are just an overhyped standardized comment format with special syntax support.
- realharo 11y agoI agree that type hints are basically just "machine-readable documentation" (and human-readable as well!). I still think that machine-readable documentation can be immensely useful when combined with a static code analysis tool. Not as useful as "real" static types would be, but useful nonetheless. It is the exact same idea as Microsoft's SAL annotations for C/C++ - https://msdn.microsoft.com/en-us/library/ms182032.aspx https://msdn.microsoft.com/en-us/library/ms182032.aspx, or Java's @NonNull, @ReadOnly, etc. annotations.