Introducing Nullable Reference Types in C#. Is there hope for D, too?
jmh530
john.michael.hall at gmail.com
Fri Nov 17 15:31:13 UTC 2017
On Friday, 17 November 2017 at 14:53:40 UTC, Jonathan M Davis
wrote:
> [snip] Regardless, given that dereferencing null will segfault,
> it does not present an @safety problem.
>
@safe is really more of @memorysafe. Null safety is orthogonal to
memory safety.
I don't really use null much in D currently, so this isn't all
that important to me ATM. Regardless, I could imagine that if one
were writing a language from scratch, you could have a default of
@nullsafe where there is a compile-time error if you violate some
null safety rules. You could then have a @nullunsafe where these
compile-time errors are disabled and you throw an exception at
run-time if you do. @nullunsafe is effectively the default in
most languages.
More information about the Digitalmars-d
mailing list