4 ms·
The type system, at least more powerful ones, encode a lot of intention and more importantly, enforce it. It might add some additional complexity in the first
by fghfghgfhfg 11y ago
The type system, at least more powerful ones, encode a lot of intention and more importantly, enforce it.
It might add some additional complexity in the first writing of the code, but in return you eliminate whole classes of problems forever. It's not just the initial writing that benefits (at some cost, admittedly), but all future changes won't have those problems either. In the case the types themselves need to change to account for expanded functionality or whatever, you again pay some cost in complexity, but in return every place the new type would cause problems you get a nice error.
The other thing to keep in mind is that whether or not these type are codified in the language they're there conceptually. Just because you have to write them down doesn't necessarily add complexity but is more like forced documentation that can be used to eliminate who classes of problems. It's difficult to see how this wouldn't intrinsically be better than so-called dynamic typing.
- Havvy 11y agoIf you're talking about a good type system, sure. The type system in Go is frankly terrible at describing the kinds of invariants and reuse we care about. I'd dare say that diaylizer (Elixir's optional but easy to use type system) would lead to more maintainable code than Go's forced type system in the long run.
- davelnewton 11y agoThat more or less sums up my view on Go in a nutshell.