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

codephantom me at noyb.com
Wed Nov 22 03:01:36 UTC 2017


On Wednesday, 22 November 2017 at 01:48:55 UTC, Jonathan M Davis 
wrote:
> In the case of null, you _can_ prove it if you have 
> non-nullable types.

True (well...you can at least 'assert' it anyway).

But if the intention is to 'assist the compiler towards knowing 
the truth/correctness about your statement', then this can be 
easily done without introducing a new nullable reference type -
i.e.
if(object != null)
  use it;

Either way, checks are made.

So I still don't see the point of adding a new nullable reference 
type to a language, unless one is asserting that it is ok to not 
already be checking for null (which seems to be the case for a 
large number of C# programmers - hence the proposal).



More information about the Digitalmars-d mailing list