I always try to have typespecs on my functions, both as an help to the reader of the code, but also in order to allow the Dialyzer to catch at least some errors.
But I have to admit that I do have quite a love/hate relationship with the Dialyzer. It does really catch potential errors, but the error messages can be really difficult to understand, especially when largish structs are involved.
Over time I’ve gotten somewhat used to the error messages so much, that I in most cases relatively quickly can scan through the errors and identify the problem. But for newcomers, it’s really not a pleasant experience.
However, as I do prefer having explicit typespecs on most functions, it is really nice to have at least some validation of them.
7 Likes