Menu
Sign In Search Podcasts Libraries 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

Or whatever that means, like in your local function, right?

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

And so you say, like whether it be in a def, and so you just say x equals hello world, right?

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

Well, if your string type requires you to allocate memory, then when it's destroyed, you have to deallocate it.

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

So in Python and in Mojo, you define that with the del method, right?

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

Where does that get run?

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

Well, it gets run sometime between the last use of the value and the end of the program.

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

Like in this, you now get into garbage collection.

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

You get into like all these long debated, you talk about religions and, and trade-offs and things like this.

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

This is a hugely hotly contested world.

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

If you look at C++, the way this works is that if you define a variable or a set of variables within a function, they get destroyed in a last in first out order.

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

So it's like nesting.

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

This has a huge problem because if you define, you have a big scope and you define a whole bunch of values at the top and then you use them and then you do a whole bunch of code that doesn't use them, they don't get destroyed until the very end of that scope.

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

And so this also destroys tail calls.

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

So good functional programming, right?

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

This has a bunch of different impacts on, you know, you talk about reference counting optimizations and things like this, a bunch of very low level things.

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

And so what Mojo does is it has a different approach on that from any language I'm familiar with, where it destroys them as soon as possible.

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

And by doing that, you get better memory use, you get better predictability, you get tail calls that work, you get a bunch of other things, you get better ownership tracking.

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

There's a bunch of these very simple things that are very fundamental that are already built in there in Mojo today that are the things that nobody talks about generally, but when they don't work right, you find out and you have to complain about.

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

Yeah, well, I mean, it's generally trivial.

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

It's after the last use of it.