On Sun, 19 May 2013 02:32:49 +0200, Jonathan M Davis <jmdavisp...@gmx.com> 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.

My experience is the complete opposite - I think maybe 20% of bugs at my job
are caused by null references. But as you say, they are very easily fixed.

That said, two things to consider:

How many of the functions you write actually need to accept nullable
pointers/references?

If non-nullable was the default, how often would you explicitly ask for a
nullable pointer/reference?

--
Simen

Reply via email to