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

Walter Bright newshound2 at digitalmars.com
Sat Nov 18 04:05:07 UTC 2017


On 11/17/2017 6:05 AM, Timon Gehr wrote:
> There are type systems that do that, which is what is being proposed for C#. 
> It's pretty straightforward: If I have a variable of class reference type C, it 
> actually contains a reference to a class instance of type C.

One of the difficulties with this is you'll still need an "empty" instance of C 
for the non-null reference to point to. Any attempts to use a method on the 
empty instance should throw.

Which is pretty much what a null reference does.

(It's also more or less what floating point NaNs do, where every operation on a 
NaN produces a NaN as a result.)


More information about the Digitalmars-d mailing list