Fixing C's Biggest Mistake
Walter Bright
newshound2 at digitalmars.com
Sun Jan 1 18:18:57 UTC 2023
On 12/31/2022 7:06 PM, Timon Gehr wrote:
> No, it absolutely, positively does not... It only ensures no null dereference
> takes place on each specific run. You can have screwed it up and only notice
> once the program is published. I know this happens because I have been a _user_
> of software with this kind of problem. Notably this kind of thing happens in
> released versions of DMD sometimes...
You're absolutely right. And if I do a pattern match to create a non-nullable
pointer, where the null arm does a fatal error if it can't deal with the null,
it's the same thing.
But we've both stated this same thing several times now.
> That's great. However, it's somewhat aggravating to me that I am currently not
> actually convinced you understand what's needed to achieve that. This is because
> you are making statements that equate nonnull pointers in the type system to
> runtime hardware checking with segmentation faults.
Yes, I am doing just that.
Perhaps I can state our difference thusly. You are coming from a type theory
point of view, and your position is quite right from that point of view.
I'm not saying you are wrong. You are right. But I am coming from an engineering
point of view, saying that for practical purposes, the hardware check produces
the same result.
If the hardware check wasn't there, I'd be all in on your approach. Which is why
I'm excited about sumtypes being used for error states.
More information about the Digitalmars-d
mailing list