Points About Type Safety
tel.github.io
tel.github.io
I was delightfully surprised running into this comment in a footnote :)
Here's the direct link to Harper's comment: http://www.pl-enthusiast.net/2014/08/05/type-safety/#comment...
The way that Harper talks about types, such as, "It is not a matter of opinion whether an untyped language is unityped, it is a matter of fact." gives me a different perspective when I program in a language that is effectively unityped.
Safety and progress is a weird distinction in the types of properties you can express. It seems to be context dependent. (I'm using what I consider the "standard", loose definitions of safety and progress: safety means the program will not go wrong, bad things won't happen; progress means the program will perform correctly, good things will (eventually?) happen.
For example, consider a program involving binary search on an array. Clearly, "does not access elements outside the bounds of the array" is a good safety property, but what is the status of "if the array is sorted, the search will correctly find a matching element or report that none exists"? It looks like a progress property, but depending on how the results are used I can see how it would become a safety problem. (I think; I'm still undecided on that point.)
In particular, "does not access elements outside of the bounds of the array" is not directly a safety property, though it could be interpreted within the dynamics in order to ensure progress. For instance, if you outlaw exception throwing then the types must ensure that exceptional states cannot arise. Else the program can "get stuck" and progress is refuted.
The final point about sorted arrays again mistakes putting "safety" and "progress" on the same epistemological ground.