Menu
Sign In Search Podcasts Charts People & Topics Add Podcast API Blog Pricing

Chris Lattner

๐Ÿ‘ค Speaker
See mentions of this person in podcasts
2524 total appearances

Appearances Over Time

Podcast Appearances

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

Also, it's called zero-cost exceptions, but it's not zero-cost by any stretch of the imagination because it massively blows out your code, your binary.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

It also adds a whole bunch of different paths because of destructors and other things like that that exist in C++.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

And it reduces the number of optimizations.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

It has all these effects.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

And so this thing that was called zero-cost exceptions...

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

It really ain't.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

Now, if you fast forward to newer languages, and this includes Swift and Rust and Go and now Mojo.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

Well, and Python's a little bit different because it's interpreted, and so it's got a little bit of a different thing going on.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

But if you look at compiled languages...

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

many newer languages say, okay, well, let's not do that zero cost exception handling thing.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

Let's actually treat throwing an error the same as returning a variant, returning either the normal result or an error.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

Now, programmers generally don't want to deal with all the typing machinery and like pushing around a variant.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

And so you use all the syntax that Python gives us, for example, try and catch, you know, functions that raise and things like this.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

You can put a raises decorator on your functions, stuff like this.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

And if you want to control that, and then the language can provide syntax for it.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

But under the hood, the way the computer executes it, throwing an error is basically as fast as returning something.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

And so this is actually, I mean, it's a fairly nerdy thing, right?

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

Which is why I love it.

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

But this has a huge impact on the way you design your APIs, right?

Lex Fridman Podcast
#381 โ€“ Chris Lattner: Future of Programming and AI

So in C++, huge communities turn off exceptions because the cost is just so high, right?