not requiring typespecs by default is basically a conspiracy to generate more work for developers.

@jonn
Soooon I've been doing elixir for 3 months now and haven't speced anything, and run credo strict on ci. I'm guessing your saying it's going to bite me 😬

Do you have any suggestions for good material to read to start specing stuff?

@solka well, it's really tricky. Dialyzer is very ad hoc. I don't have any resources. I think I learned by reading some Uppsala paper on progressive typing with dialyzer and then by asking stuff in user mailing list. Gladly, these days, the Internet is full of high-quality answers to questions of beginners. I keep forgetting how to read some error messages, so I sometimes resort to looking the errors up.

@solka but if you ask me, ElixirLS plugin for VSCode provides nice suggestions. So does Co-pilot. Start by speccing some simple pure functions, then get familiar with unions and parametric types.

Just remember one thing: dialyzer can't go as deep as you like. Iirc, it parametrises 3-deep. Thus, list(list(list(atom))) is the same as list(list(list())) and is the same as list(list(list(boolean))). 4th level gets dropped. (Or 3rd! I don't remember).

@jonn
Thanks for the tips! I'll mess with it this week! I was scared away by the dialyzer errors. They are hard to read!;

Sign in to participate in the conversation
Doma Social

Mastodon server of https://doma.dev.