null Vs [] return arrays

bearophile bearophileHUGS at lycos.com
Fri Apr 1 03:48:27 PDT 2011


Regan Heath:

> conceptually it's nice to be able to express (exists but is empty) and  
> (does not exist).

You may want to express that, but for the implementation of the language those two situations are the same, because in the [] literal the ptr is null. So I think it's better for the programmer to not differentiate the two situations, because they are not different. If the programmer tells them apart, he/she is doing something bad in D, creating a false illusion.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list