3 ms·
I think you’re confusing expressiveness of types with static/dynamic typing (the latter are also typed!) An expressive type system would allow you to define bo
by snotrockets 4y ago
I think you’re confusing expressiveness of types with static/dynamic typing (the latter are also typed!)
An expressive type system would allow you to define both a cent and dollar types, s.t. assignments of those types to each other without conversion would fail.
In a way, it is
a way to have the computer validate apps Hungarian rather than trusting the programmer (well, it’s more, but for this argument).
Go’s type system is anachronistic, compared to what modern language provides (but then, all of go is anachronistic on purpose. The usefulness of this purpose not to be discussed here).
- xg15 4y agoAh, my bad there. That was what I meant with subtypes, but you're right, things have moved further there already. Sorry for the misinfo!
- stavros 4y agoYeah, defining "dollars" and "cents" (and over units) types are actually a really good solution for this, it means that you can never pass a value of one unit when the function expects another.
- shepherdjerred 4y ago> The usefulness of this purpose not to be discussed here This is a fantastic bit to tack on for divisive topics, I'm stealing it.