Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

Timon Gehr timon.gehr at gmx.ch
Sat May 18 19:03:07 PDT 2013


On 05/19/2013 02:32 AM, Jonathan M Davis wrote:
> On Sunday, May 19, 2013 02:22:43 Simen Kjaeraas wrote:
>> Or... possibly, the current holes in @disable are fixed, and NonNull!T
>> becomes the default, because we tell people to always use them, rather
>> than flail our arms and behave like idiots. ("regular pointers are
>> broken, use NonNull!T" is a pretty good argument if it's true)
>
> I've never understood why so many people feel that nullable pointers are a
> problem. Clearly, many people do, but personally, I've rarely had problems
> with them, and there are plenty of cases where not being to make a pointer
> null would really suck (which is why we're forced to have
> std.typecons.Nullable for non-reference types). I'm not arguing against having
> non-nullable pointers, but I'd probably almost never use them myself, as I
> really don't think that they'd be buying me much. In my experince, problems
> with null pointers are extremely rare and easily caught.
>
> -  Jonathan M Davis
>

I don't write a lot of buggy code for myself either. You are arguing for 
leaving out cheap code documentation. Also, in a sane system you'd be 
forced to use types without a null value in many cases, as potentially 
null references ought not be dereferenced. i.e. potentially null would 
mean they _really_ can be null, because otherwise an actual reference to 
a value type could be used.


More information about the Digitalmars-d mailing list