Disallow null references in safe code?

Idan Arye GenericNPC at gmail.com
Tue Feb 4 06:34:48 PST 2014


On Tuesday, 4 February 2014 at 08:32:26 UTC, deadalnix wrote:
> On Tuesday, 4 February 2014 at 06:49:57 UTC, Andrei 
> Alexandrescu wrote:
>>> That would be awesome. The breakage involved, is quite high 
>>> however.
>>
>> No breakage if the opt-in flag is not used.
>>
>> Andrei
>
> OK, If you are willing to do that change, I'm 200% behind !
>
> Question, why do you propose to use @nullable instead of 
> Nullable!T ?

Probably because `Nullable!` suggests that's it's a library 
solution - and it isn't. In order to implement nullables without 
core language support for nullables you need to do some 
workarounds that waste memory and cycles. Also, implementing it 
as a core language feature makes life easier for the optimizer.

At any rate, currently all built-in attributes that use the @ 
prefix(all two of them are declaration attributes - but 
`@nullable` should be a type attribute, so we can send things 
like `@nullable(int)` as template parameters.


More information about the Digitalmars-d mailing list