Chris Lattner
๐ค SpeakerAppearances Over Time
Podcast Appearances
That's kind of a different thing.
We can go back to that if you want.
But typically, you just say, I have a def, and my def takes two parameters.
I'm going to call them a and b, and I don't have to write a type.
So that works.
is great, but what that does is that forces what's called a consistent representation.
So these things have to be a pointer to an object with the object header, and they all have to look the same.
And then when you dispatch a method, you go through all the same different paths, no matter what the receiver, whatever that type is.
So what Mojo does is it allows you to have more than one kind of type.
And so what it does is allows you to say, okay, cool, I have an object and objects behave like Python does.
And so it's fully dynamic and that's all great.
And for many things, classes, like that's all very powerful and very important.
But if you want to say, hey, it's an integer and it's 32 bits or 64 bits or whatever it is, or it's a floating point value,
and it's 64 bits.
Well, then the compiler can take that and it can use that to do way better optimization.
And it turns out, again, getting rid of the interactions, that's huge.
It means you can get better code completion because you have, because compiler knows what the type is.
And so it knows what operations work on it.
And so that's actually pretty huge.
And so what Mojo does is it allows you to progressively adopt types into your program.