26 ms·
You make it seem like such a terrible thing, but a valueless state is the only exception to "you can make invalid states unrepresentable", and a pretty useful o
by dataflow 2y ago
You make it seem like such a terrible thing, but a valueless state is the only exception to "you can make invalid states unrepresentable", and a pretty useful one given the rest of the language. And it's not one that you have to worry about in practice because nobody will intentionally abuse this, and your compiler/linter will diagnose accidental reuses. Guarding against it anyway is like guarding against someone passing a destroyed object to you - it just doesn't make sense to.
- gumby 2y ago> Guarding against it anyway is like guarding against someone passing a destroyed object to you - it just doesn't make sense to. It doesn’t make sense to do so intentionally, but that’s a classic dangling-pointer/use-after-free bug. In some contexts it might make sense to guard against it for the same reasons one may validate arguments passed to a public API (and then not in the internal code)