Chris Lattner
๐ค SpeakerAppearances Over Time
Podcast Appearances
So according to the Python spec, you can write pretty much anything in a type position.
And technically, you can write any expression.
Now, that's beautiful because you can extend it.
You can do cool things.
You can build your own tools.
You can build your own house linter or something like that.
But it's also a problem because any...
existing Python program may be using different tools and they have different interpretations.
And so if you adopt somebody's package into your ecosystem, try around the tool you prefer, it may throw out tons of weird errors and warnings and problems just because it's incompatible with how these things work.
Also because they're added late and they're not checked by the Python interpreter, it's always kind of more of a hint than it is a requirement.
Also, the CPython implementation can't use them for performance.
Yep, exactly.
And this all comes back to the design principle.
They're kind of hints.
The definition's a little bit murky.
It's unclear exactly the interpretation in a bunch of cases.
And so because of that, you can't actually, even if you want to, it's really difficult to use them to say, like, it is going to be an int, and if it's not, it's a problem, right?
A lot of code would break if you did that.
So, so in Mojo, right?
So you can still use those kinds of type annotations.