Error about @disabled constructor when there is a custom one

deadalnix deadalnix at gmail.com
Wed Jan 23 00:43:30 PST 2013


On Wednesday, 23 January 2013 at 08:00:05 UTC, Simen Kjaeraas 
wrote:
> On 2013-45-23 04:01, deadalnix <deadalnix at gmail.com> wrote:
>
>> On Tuesday, 22 January 2013 at 19:07:56 UTC, Simen Kjaeraas 
>> wrote:
>
>>> One could argue that the compiler should choose the other 
>>> constructor, and
>>> even that having default constructors is reasonable. However, 
>>> D has gone
>>> the route of not having default constructors for structs. 
>>> Instead,
>>> structs are defined to be trivially constructible from T.init.
>>>
>>
>> Which incompatible with the desire of a NonNull construct.
>
> Really? It's not like you cannot @disable T.init. Please show 
> how this is
> a problem for NonNull!T.
>

Easy :

NonNull!T bar; // bar is null

NonNull!T[] barArray;
barArray.length = 5; // barArray contains null elements.

NonNull!T bar = something;
foo(move(bar));
bar; // bar is null \o/

In fact they is so much way to create null stuff here that it 
isn't even remotely difficult to create a NonNull that is null;


More information about the Digitalmars-d mailing list