3 ms·
I agree that's also a valid point. The solution is for the language to offer 'option types', which essentially force you to check for null. Zig does this, and
by MaxBarraclough 7y ago
I agree that's also a valid point.
The solution is for the language to offer 'option types', which essentially force you to check for null. Zig does this, and the result is much nicer than how things work in C: https://ziglang.org/documentation/master/#Optionals https://ziglang.org/documentation/master/#Optionals
- ctidd 7y agoAnd options help with solidifying input contract as well as the output. Knowing what's an acceptable input via a type system is just as relevant as knowing what is a potential output.
- setr 7y agoMore importantly, they let you safely not check for null (because with null-types, you should really always be handling it, because anything can go from never-null to null-in-this-one-case without warning)