3 ms·
50+ years and people still fail to grasp this. You have to put something (an optional, or a default constructed object in a useless state) and all you did was
by nurettin 3y ago
50+ years and people still fail to grasp this.
You have to put something (an optional, or a default constructed object in a useless state) and all you did was to skip the null check. In case of optional, you introduced a stack rewind or a panic. Everything else stayed the same. Maybe that default even deleted the hard drive instead of crashing.
Coding is hard. "just don't code" is not the answer. You can avoid something, that doesn't mean it won't show up in some other fashion.
- sam0x17 3y agoAgain, if you disallow unwrapping and panicking at the CI level, you actually force your developers to properly handle these situations.
- mrkeen 3y ago> You have to put something (an optional, or a default constructed object in a useless state) No, you really don't. There is no default number, no default string, no default piece of legislation, no default function.