Sebastian Scholz
๐ค SpeakerAppearances Over Time
Podcast Appearances
And then I like to make sure that
We use the type system to its full extent and to encode any preconditions, as I said, into these types.
It's kind of like if you have a precondition for using a value that can't be zero, in Rust, you have the non-zero type.
So Rust itself uses a lot of these types for preconditions as well.
Same with the C string, a string that has to be zero, null by terminated.
So Rust itself gives us a lot of these ideas as well.
And so when I examine code, I'm just trying to think of all of these different invariants that need to hold true for a specific code.
I'm trying to find them out and make sure that they're expressed as much as possible.
Are you a friend of debug assertions?
Well, I mean, we use them extensively as well, but only in places where we can't guarantee something just with the type system.
I mean, there's always certain things that you can't guarantee at compile time, especially if you're
Some of these things you just can't do with just the type system.
Some of the runtime state that can't be known at compile time, we, for example, have our own heap.
And so the idea of a heap is that you have a bunch of memory available and you at runtime allocate things out of that heap as needed.
You can never kind of really be sure how much you allocate just from looking at your code because it depends on timing.
It depends on when certain pieces of code need certain amount of memories.
And so for those kind of