Can non-nullable references be implemented as a library?

Simen kjaeraas simen.kjaras at gmail.com
Sun Nov 7 09:19:40 PST 2010


Denis Koroskin <2korden at gmail.com> wrote:

> Since many people think that non-nullable references can be implemented  
> as a library and thus don't belong to core language, I've decided to  
> show that it is in fact impossible to do so.
>
> How do you enforce the following behavior:
[snip]
>
> Without support of these use-cases NonNull!(T) is useless.
>
> There can be other examples, but I think these are enough to prove that  
> non-nullable references can not be implemented in library.

Indeed. There is also the arrays I've mentioned before, and as you
mention here, fields of classes and structs. Good catch.

-- 
Simen


More information about the Digitalmars-d mailing list