Disallow null references in safe code?

Idan Arye GenericNPC at gmail.com
Tue Feb 4 05:43:59 PST 2014


On Tuesday, 4 February 2014 at 13:20:12 UTC, Dicebot wrote:
> On Tuesday, 4 February 2014 at 13:11:49 UTC, Idan Arye wrote:
>> Why is `bar(w);` an error? I may be perfectly valid for `bar` 
>> to accept null as argument.
>
> It should declare its argument as Nullable!w then.

If non-null-by-default will be implemented that code will crash 
on the first line `Widget w = null;`. I was not talking about 
that - I was talking about the static analysis deadalnix 
demonstrated in the comments of that code.


More information about the Digitalmars-d mailing list