Simon Peyton Jones
π€ SpeakerAppearances Over Time
Podcast Appearances
They're the way that I start writing my designs.
I think there's no benefit to weaker.
Oh, no, they may be good.
So we started.
If you have Pascal,
and you write a function to reverse a list of integers, then if you apply it to a list of characters, the same machine instructions would work, but it is rejected.
So we have rejected a perfectly decent program, bad.
Our goal is to expand the collection of the programs that satisfy the type system to include as many as possible of the programs we want to run without including any of the bad programs that we don't want to run.
Parametric polymorphism is a big step in that direction.
Other type system innovations are a big step in that direction, but there will always be some programs that would run perfectly well that the type system rejects.
Imagine a tree that contains integers at every node, but
If you are 17 deep in the tree, or 34, or 51, if you're in a multiple of 17 deep, the integers can be characters instead.
Or the integers all turn out to be characters, right?
Now, you could write a program that generated such trees, and you could write a program that consumed such trees, knowing that every 17th layer, we switch to characters.
But most static type systems would make it pretty hard for you to accept that program.
And yet, it will run.
Now, you might say, oh, but I really want to write that program, guys.
You know, don't get in my way.
Well, then...
Then we should provide a way for you to bail out into dynamic typing.