3 ms·
For the case where something really could be absent, you're right; it's the same amount of code. The difference is that in a language with null you have to writ
by lmm 7y ago
For the case where something really could be absent, you're right; it's the same amount of code. The difference is that in a language with null you have to write that code for every single function parameter, whereas in Rust you can have required parameters that are actually required and only need to check the genuinely optional cases (which is what, maybe 5% of the time?). Make invalid states unrepresentable.