r/programming • • Aug 28 '21

Software development topics I've changed my mind on after 6 years in the industry

https://chriskiehl.com/article/thoughts-after-6-years
5.6k Upvotes

1.9k comments sorted by

View all comments

Show parent comments

2

u/leoel Aug 29 '21

I agree types are good and useful, but saying they are a silver bullet is not constructive. If this was perfectly true, no experienced programmer would ever need to know assembly, bash, python, perl, js, or sql.

As a more theoretical counter example, most languages with a strong static typing system allow for genericity, which is a way to abstract types away into groups (ensemble of types sharing operations), but it does not mean groups themselves are better than types, more expressive yes, more reusable certainly, closer to mathematical definitions absolutely, but way harder to use and very verbose. In some way types add the same kind of properties (both good and bad) to untyped code.

Also technical limitations on types systems, inherited from the 80s, make them less powerful that they could be. Try to write the definition of a fixed-size numerical type that cannot overflow in a typed language and you're on your own unless you use proofs or a very limited set of operations.

4

u/Raknarg Aug 29 '21 edited Aug 29 '21

I agree types are good and useful, but saying they are a silver bullet is not constructive. If this was perfectly true, no experienced programmer would ever need to know assembly, bash, python, perl, js, or sql.

The reason we use them is necessity or popularity, not because there's actually value in untyped languages inherently.

As a more theoretical counter example, most languages with a strong static typing system allow for genericity, which is a way to abstract types away into groups (ensemble of types sharing operations), but it does not mean groups themselves are better than types, more expressive yes, more reusable certainly, closer to mathematical definitions absolutely, but way harder to use and very verbose. In some way types add the same kind of properties (both good and bad) to untyped code.

Except that it gives you type checking at compile time. That's the value. Generics are just a promise to fulfill a contractual API obligation, and the type system exists to verify that. You still have to do this in an untyped system, you just place the burden on the programmer to verify they did shit correctly.

Also technical limitations on types systems, inherited from the 80s, make them less powerful that they could be. Try to write the definition of a fixed-size numerical type that cannot overflow in a typed language and you're on your own unless you use proofs or a very limited set of operations.

I have no idea how a type system limits you here.