NonNull template

Derek Fawcus dfawcus+dlang at employees.org
Sat Apr 19 10:37:23 UTC 2025


On Friday, 18 April 2025 at 07:21:43 UTC, Ogion wrote:
> Isn’t `ref` essentially a non-null pointer?

Not really, it is similar but not the same.

The thing pointers give, or rather the syntax of initialising 
them gives, is easy local reasoning, due to having to explicitly 
use the address of (&) operator.

So any function in a different compilation unit is a lot easier 
to reason about if one does not have to worry about if an 
argument may experience an under the covers change due to the 
parameter being defined as a reference.

Sadly, that state already exists, so it is rather a case of water 
under the bridge.




More information about the Digitalmars-d mailing list