Simen kjaeraas <simen.kja...@gmail.com> wrote:

Denis Koroskin <2kor...@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.

Worth adding:
Even if non-null references/pointers cannot be perfectly implemented in a
library, they may still be a worthwhile addition to Phobos, to mark
function arguments and the like.

--
Simen

Reply via email to