Chris Lattner
๐ค SpeakerAppearances Over Time
Podcast Appearances
And so the zero cost cost is so high, right?
And so that means you can't actually use exceptions in many libraries.
And even for the people that do use it, well, okay, how and when do you want to pay the cost?
If I try to open a file, should I throw an error?
Well, what if I'm probing around looking for something, right?
I'm looking it up and made different paths.
Well, if it's really slow to do that, maybe I'll add another function that doesn't throw an error or turns an error code instead.
And I have two different versions of the same thing.
And so it causes you to fork your APIs.
Yeah.
And so, you know, one of the things I learned from Apple and I still love is the art of API design is actually really profound.
I think this is something that Python's also done a pretty good job at in terms of building out this large-scale package ecosystem.
It's about having standards and things like this.
And so, you know, we wouldn't want to enter a mode where...
You know, there's this theoretical feature that exists in language, but people don't use it in practice.
Now, I'll also say one of the other really cool things about this implementation approach is that it can run on GPUs and it can run on accelerators and things like this.
And that standard zero cost exception thing would never work on an accelerator.
And so this is also part of how Mojo can scale all the way down to like little embedded systems and to running on GPUs and things like that.
Yeah.
Yeah, so the way to think about it is think about a function that doesn't return anything, just as a simple case, right?