4 ms·
Erm, you can setup dialyzer to be as strict as possible. This might not catch all the errors because of the nature of messages, but this is a pretty small part
by mapcars 6y ago
Erm, you can setup dialyzer to be as strict as possible. This might not catch all the errors because of the nature of messages, but this is a pretty small part of a system usually and can be covered by tests.
>All in all it's not a useful substitute for a real type system used to model things.
>Type specs aren't useful for domain modelling
Can you give me some examples?
- 59nadir 6y ago> Erm, you can setup dialyzer to be as strict as possible. No. This is just plain false. Having used dialyzer since 2016 I can tell you it's not useful as a substitute for statically checked types via a compiler, with real strictness (which includes "When I don't have enough info, that's a type error"). > This might not catch all the errors because of the nature of messages, but this is a pretty small part of a system usually and can be covered by tests. Not only will it not catch obvious type errors, it will also report false types when the core team doesn't use dialyzer in their libraries (because it doesn't work). These will bubble up to you instead and while you're mad they're not using dialyzer you'll still have to admit you understand why they don't. I'm not sure what you mean by give you examples of how Elixir type specs aren't useful for domain modelling. They're ad-hoc, serve as documentation at best and even if they had structural power enough to express basic things they aren't checked at all, so you're getting none of the guarantees you would get in a statically checked language where your model changes and you can safely go forward by seeing what needs changing additionally to adapt.
- mapcars 6y ago>They're ad-hoc, serve as documentation at best and even if they had structural power enough to express basic things they aren't checked at all What they are is how you use them, can you show how you can model something with static types and how it is different from dialyzer?