Matthias Endler
๐ค SpeakerAppearances Over Time
Podcast Appearances
A lot of people might be curious about, you know, exactly this process of working for quote-unquote a space company.
Couldn't you also use a type state pattern for that?
Yeah, I never heard about that types with keys pattern, the token pattern that you described.
Is that a thing that you invented or does it come from any other project specifically?
Now I understand part about loosely coupled components as well, because I'm not sure, but I guess Embassy used the type state pattern and a lot of generics for the pins before.
I'm not sure if they dialed it down a bit or dialed it back, because...
you sometimes want to repurpose pins.
And if you set up your system once, it's not as flexible as if you were to be able to change that dynamically, sort of.
And at the same time, you just use the normal ownership rules in Rust to enforce the same behavior.
So you can still encode it in the type system without really having a lot of
overhead and a lot of complexity on the type system level.
Because that's sort of the only place where you can get that token from.
That's pretty impressive.
At the risk of going a bit meta here...
How do you come up with these patterns?
Do you find them online in certain other crates or do you think really hard about those problems and then start to encode those invariants?
It's not really discoverable.
Do you write down those correctness guidelines somewhere?
Well, I guess you review a lot of Rust code nowadays, a lot of Rust code that should or cannot fail.