[article] Language Design Deal Breakers

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon May 27 07:34:14 PDT 2013


On 5/27/13 3:45 AM, Jonathan M Davis wrote:
> On Monday, May 27, 2013 09:27:58 deadalnix wrote:
>> What need to be added to the language to make the lib work is
>> equivalent to what is needed to make it the default (Make the
>> compiler track initialization), and is also required for other
>> aspects of the language (initialize immutable objects).
>
> I don't see why. NotNull would statically prevent assigning null to it (which
> is easy to do, since null has its own type) and will assert that any
> references assigned to it are null.

The problem is when NonNull is a member:

class A {
   NonNull!A next;

   this() {
      if (condition) next = new A;
      while (!another_condition) {
         if (yet_another_condition) {
             next = new A;
             break;
         }
      }
   }

}


Andrei


More information about the Digitalmars-d mailing list