Fixing C's Biggest Mistake

Timon Gehr timon.gehr at gmx.ch
Sat Dec 31 02:15:43 UTC 2022


On 12/31/22 02:45, Walter Bright wrote:
>>
>> If the arm for null is fatal then the programmer must have 
>> deliberately opted-in to a fatal error by typing e.g. `assert(0)`. Not 
>> accidentally forgetting to handle null, which is a common mistake.
> 
> Yes, that's exactly what I was talking about. You've substituted a free 
> hardware check for a costly check.
> ...

Well, he said "e.g.". It's perfectly reasonable to design the language 
such that people can opt into the free hardware check. Ultimately those 
are implementation details.

> ...
> ----
> 
> But hey, this discussion is ultimately pointless. D will get sumtypes 
> and pattern matching at some point. You can write code in your preferred 
> style - no problem!

So far my understanding is that you are aiming for:
- keep references/pointers with implicit null values
- add references/pointers with explicit null values

What's still potentially missing:
- references/pointers without any null values (fundamentally at odds 
with T.init, this is why I brought this up in the first place)
- static checking


More information about the Digitalmars-d mailing list