Introducing Nullable Reference Types in C#. Is there hope for D, too?

codephantom me at noyb.com
Wed Nov 22 00:19:51 UTC 2017


On Tuesday, 21 November 2017 at 20:02:06 UTC, Timon Gehr wrote:
>
> I'm confident that you would be able to use null safe languages 
> properly if that is what had been available for most of your 
> career.
>

You do realise, that all of the issues you mention can just be 
handled by coding correctly in the first place.

If your program calls 'std.math.log' with an argument of 
'-123.4', then that's probably NOT a bug. It's more likely to be 
incorrect code. Why not bounds-check the argument before passing 
it to the function?

If you access a field of an invalid instance of an object, that's 
probably NOT a bug. It's more likely to be incorrect code. Before 
you access a field of an object, check that the object is valid.

Its seems to be, that you prefer to rely on the type system, 
during compilation, for safety. This is very unwise.

btw. what was the last compiler you wrote?



More information about the Digitalmars-d mailing list