Chris Lattner
๐ค SpeakerAppearances Over Time
Podcast Appearances
when you're passing values around, you don't want to do extra reference counting for no good reason.
And so you have to make sure that you're efficient and you transfer ownership instead of duplicating references and things like that, which is a very low level problem.
You also have to adopt this and you have to build these data structures.
And so if you say,
You know, Mojo has to be compatible with Python, so of course the default list is a reference semantic list that works the way you'd expect in Python.
But then you have to design a value semantic list.
And so you just have to implement that, and then you implement the logic within.
And so the role of the language here is to provide all the low-level hooks that allow the author of the type to be able to get and express this behavior without forcing it into all cases or hard-coding this into the language itself.
Yes, and so there's a whole system called ownership, and so this is related to work done in the Rust community.
Also, the Swift community has done a bunch of work, and there's a bunch of different other languages that have all kind of... C++ actually has copy constructors and destructors and things like that, and so... I mean, C++ has everything, so it has move constructors, it has this whole world of things, and so...
This is a body of work that's kind of been developing for many, many years now.
And so Mojo takes some of the best ideas out of all these systems and remixes it in a nice way so that you get the power of something like the Rust programming language, but you don't have to deal with it when you don't want to, which is a major thing in terms of teaching and learning and being able to use and scale these systems.
Yeah, so if you go deep into systems programming land, so this isn't, again, this is not something for everybody, but if you go deep into systems programming land,
what you encounter is you encounter these types that get weird.
So if you're used to Python, you think about everything, I can just copy it around, I can go change it and mutate it and do these things and it's all cool.
If you get into systems programming land, you get into these things like I have an atomic number, or I have a mutex, or I have a uniquely owned database handle, things like this, right?
So these types you can't necessarily copy.
Sometimes you can't necessarily even move them to a different address.
And so what Mojo allows you to do is it allows you to express, hey, I don't want to get a copy of this thing.
I want to actually just get a reference to it.