Last active
August 29, 2015 13:55
-
-
Save non/8697842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The analogy is comparing writing programs to buying goods: | |
writing a program with static types is equivalent to buying | |
with cash, and writing a program with dynamic types is | |
equivalent to buying with credit. | |
The "cost" in either case is mental energy and time. When I | |
write a program with static types I spend a lot of effort up | |
front, guided by the type system and compiler, to handle edge | |
cases and generate a totally correct solution. I have to | |
fully-understand any libraries I'm using and characterize | |
the problem in terms of types. | |
When I write a program with dynamic types, I typically get | |
something I can run much faster, but then I struggle through | |
compose/test/debug cycles until the program is eventually | |
correct. The energy cost here is spread out (potentially | |
over days or weeks) instead of happening earlier. | |
The correct program is the thing I am buying in this analogy, | |
not the currency I'm spending. |
Doesn't Spire count?
Well, Spire is an interesting case. I mean, it's a big project, but as a library it's pretty modular. Also, there have been many collaborators (which is something a good type system has made way easier).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be clear, I find a ton of joy in working with static types so that when my program compiles it often works correctly without bugs.
I am just trying to reconcile this with the fact that I haven't yet written any large personal tools comparable to those I built in Python back when that was my go-to language.