3 ms·
Yes, types are documentation; needed in large projects.
by hyperpallium 11y ago
Yes, types are documentation; needed in large projects.
- earthboundkid 11y agoI think the pro-type inference crowd really misses this point. Types have two jobs: improve performance and force documentation of expectations. Of the two jobs, the latter is more important because you can hack the performance issue with JIT and whatnot. Extreme type inference risks losing the whole point of static typing. If you make a function, it should have its types documented, period. Either the type expectations a function has are trivial, in which case you may as well just write them out, or they are complicated, in which case you absolutely need to document them. Type inference is great for function invocation and okay as typeclass/generic system, but in a large project, you should never create a function or method without specifying the types you expect to handle.