Shouldn't invalid references like this fail at compile time?

Seb seb at wilzba.ch
Wed Jan 24 21:24:16 UTC 2018


On Wednesday, 24 January 2018 at 19:12:50 UTC, Steven 
Schveighoffer wrote:
> While I understand your argument, the truth is that avoiding 
> null dereferencing *statically* has to be built into the 
> language from the beginning. As D is already too far along to 
> retrofit this, your 2 options are:
>
> a) instrument the code, as Jonathan suggests (every dereference 
> checks for null ahead of time).
>
> b) restrict your code, design, and functions that you use to 
> ensure null pointers cannot happen.

There's also:

c) Improve/split the language by introducing -dip25 / -dip1000 
and hope that people interested in memory safety will migrate 
their code to it.


More information about the Digitalmars-d mailing list