The NaN of types (in D)

Paul Backus snarwin at gmail.com
Mon Oct 12 15:03:07 UTC 2020


On Monday, 12 October 2020 at 14:46:14 UTC, Joseph Rushton 
Wakeling wrote:
> On Monday, 12 October 2020 at 14:11:22 UTC, Paul Backus wrote:
>> The issue with null references is not related to memory 
>> safety. NullPointerException in Java is not a memory-safety 
>> error, for example. The issue with nullable references is that 
>> you have to check every reference for null before you use it, 
>> or your program will crash.
>>
>> By contrast, NaN will not crash your program if you forget to 
>> check for it before using it in an expression.
>
> Right.  I'm just not sure I follow why the ø Stefan is defining 
> wouldn't behave more like NaN than a null pointer.

Since ø is not a type, I assume that you will get an error if you 
try to use it for anything that requires a type--for example, 
declaring a variable, or asking for its .sizeof.

If this is not the case, I invite Stefan to correct me.


More information about the Digitalmars-d mailing list