|
|
Subscribe / Log in / New account

Missing the point of loose languages

Missing the point of loose languages

Posted Dec 27, 2021 8:26 UTC (Mon) by NAR (subscriber, #1313)
In reply to: Missing the point of loose languages by rdeforest
Parent article: Wrangling the typing PEPs

Erlang is one language where the type system was added later. In my experience it's most useful for documentation - now there's a standard way to specify the type of the arguments in an API function. There's a tool (dialyzer) that checks for type errors: I worked on a project where the type annotations were added on later, about 95% of the errors it found were in dead code (so not covered by unit tests - one such example was a branch that only executed if the current date was before 2000, and we were adding the type specs in 2010). If there is a decent test coverage, there's little (but not zero!) value the type system can add.


to post comments

Missing the point of loose languages

Posted Dec 27, 2021 9:59 UTC (Mon) by smurf (subscriber, #17840) [Link]

IMHO the best thing about explicit typing is documentation. I can see what a variable/parameter is supposed to be without checking external and possibly-out-of-date docs (including broken comments right above the function in question …).

A decent set of test cases is great for checking that the expected cases work as expected. The problem is that some [ft]ools insist on tests for each and every unexpected case, even if logically impossible to reach, while the real problems (i.e. those conditions you didn't even think of being remotely possible when you wrote the code) slip under the radar.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds