4 ms·
The self-documenting nature of statically typed programs is something that critics often miss. Making a contribution to an existing codebase is far easier when
by twblalock 10y ago
The self-documenting nature of statically typed programs is something that critics often miss. Making a contribution to an existing codebase is far easier when it is statically typed. You can very easily understand what you ought to do, because the constraints of the type system help you figure out exactly what things are, what arguments you can pass to a method, how the other programmers used the types, etc.
In contrast, contributing to an existing codebase in PHP or Rails is much harder. Nothing will stop you from sending the wrong arguments to a method, or adding members to classes that should not be modified, or even simply refactoring and forgetting to change all of the usages of the types and methods you modified.
- Retra 10y agoWell, the converse argument is that most dynamically typed languages allow you to explore the codebase in a REPL by playing with it. And there's a reasonable amount of noise that is added by static types, since often the types don't tell you how to use them, so you have to read the docs anyhow. Which really means there's a big difference between static types that everyone knows and uses, and those that someone invented for particular use. That difference seems more significant than the static/dynamic divide.
- twblalock 10y agoThere are statically-typed languages with REPLs, e.g. Scala, C#, F#, and the upcoming Java 9, so REPLs are not an advantage of dynamic languages. There are even REPLs for C++. Many people's impressions of static languages are based on Java from 10 years ago. It's really quite different now.
- bjz_ 10y agoI find the Haskell, SML, and OCaml repls very nice to use as a exploratory tools. It's made all the nicer due to the types, because you can quickly iterate on gluing things together in different ways. It's something I miss with Rust, although there is progress being made to implement one.