7 ms·
Reading all comments here I'm not sure what kind of typesystems you are refering to. (you mention static typesystems but the discussion seems broader than that)
by CapsAdmin 5y ago
Reading all comments here I'm not sure what kind of typesystems you are refering to. (you mention static typesystems but the discussion seems broader than that)
They come in different forms. Some can rely heavily on inference (Typescript) and some need to be very verbose (Java)
There are structural typesystems (Typescript) and nominal typesystems (Java)
In a structural typesystem the contents of a type can be compared to another type and match, whereas in a nominal typesystem it has to be the same type id to match. The former is more dynamic than the latter.
I don't like Javas typesystem but I like Typescripts typesystem because it's more flexible and doesn't force you to be verbose (you can for example only type function arguments and let it infer the rest)
One benefit I haven't seen mentioned here is the ability to refactor code with confidence and less need for unit tests.
For example comparing Javascript to Typescript; If I change a functions argument that is used in many places, the typesystem will give me a list of other code where the function is used I need to change in order for everything to work again.
- kaliszad 5y agoI was referring mostly to Javas nominal typesystem. Thank you for trying to make the discussion more to the point/ precise.