Where do type systems come from? (2017)
It never ceases to amaze me how theorists can take simple concepts and make them impenetrable.<p>A type is a (possibly infinite) subset of all the possible values that can be provided as input to a program, or all the possible results a program can produce.<p>Type theory is about trying to figure out at compile time, if the inputs to a function are of a certain type (i.e. belong to a certain subset) what type the output will be (i.e. what subset of possible values the output will belong to).<p>It is not possible to figure this out in general because that would require solving the halting problem, so the art of designing type systems is choosing subsets of the data that allow you to prove useful things about programs at compile time so that you can find errors before the program runs, and eliminate run-time checks and hence make the programs run faster.<p>The reason people who like dynamically typed languages get frustrated with statically typed languages is that they value development speed more than they value run-time speed or avoiding of run-time errors, so they don&#x27;t want to put in the extra effort needed to provide the compiler with the information it needs to do these compile-time derivations, or put up with the compiler complaining when it is unable to do them.  They just want the program to run, and they&#x27;re willing to pay for that with some inefficiency and run-time errors.<p>That&#x27;s pretty much it.