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

codephantom me at noyb.com
Wed Nov 22 00:39:21 UTC 2017


On Wednesday, 22 November 2017 at 00:19:51 UTC, codephantom wrote:
> Its seems to be, that you prefer to rely on the type system, 
> during compilation, for safety. This is very unwise.
>

To demonstrate my point, using code from a 'safe' language (C#):
(i.e. should this compile?)

// --------------------------------------------------

using System;

public class Program
{


     public static int Main()
     {
         Foo();
         return 0;
     }

     static void Foo()
     {
         const object x = null;

         //if (x != null)
         //{
             Console.WriteLine(x.GetHashCode());
         //}
     }

}

// --------------------------------------------------




More information about the Digitalmars-d mailing list