Sum Types - first draft

Paul Backus snarwin at gmail.com
Tue Sep 10 18:14:57 UTC 2024


On Tuesday, 10 September 2024 at 18:03:32 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> A non-null pointer is guaranteed by the compiler (at compile 
> time), that it may ONLY point to a valid value that is directly 
> usable.

This is actually not true. You are conflating two separate 
properties: whether a pointer is null, and whether it is valid to 
dereference.

In D, we have @safe to guard against _invalid_ pointers, but we 
do not have any way to guard against null pointers. (Indeed, 
because of this, @safe relies on `null` being _valid_ to 
dereference!)


More information about the dip.development mailing list