4 ms·
>> when a Left value is accidentally read as a Right one, you don't get a "random" bit pattern due to type punning, but a correct (albeit meaningless) value suc
by potkor 14y ago
>> when a Left value is accidentally read as a Right one, you don't get a "random" bit pattern due to type punning, but a correct (albeit meaningless) value such as NULL
> How is that any worse than the current situation of not checking the error side and reading an undefined (or whatever it is?) value?
You get deterministic failure modes instead of dragons flying out of your nose.
Also assigning error in a variable ignoring it
sticks out a lot more. The single-return value C
version doesn't tell you if it can return failure or not.
edit: fixed quoting
- sausagefeet 14y ago> You get deterministic failure modes instead of dragons flying out of your nose What Go currently has does not solve this problem, which is what I'm pointing out. Your argument is basically "not handling the error Looks Bad". Mine is "It should be impossible to do wrong". Something like ADT's would have been very welcomed, then we could just have a classy option type or either type.