Disallow null references in safe code?
deadalnix
deadalnix at gmail.com
Tue Feb 4 10:20:32 PST 2014
On Tuesday, 4 February 2014 at 13:44:00 UTC, Idan Arye wrote:
> 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.
Dicebot is right.
More information about the Digitalmars-d
mailing list