Empty VS null array?

Timon Gehr timon.gehr at gmx.ch
Fri Oct 18 13:14:44 PDT 2013


On 10/18/2013 09:58 PM, H. S. Teoh wrote:
> To me, these are just implementation details. Conceptually speaking, D
> arrays are actually slices, so that gives them reference semantics.
> Being slices, they refer to zero or more elements, so either their
> length is zero, or not. There is no concept of nullity here. That only
> comes because we chose to implement slices as pointer + length, so
> implementation-wise we can distinguish between a null .ptr and a
> non-null .ptr. But from the conceptual POV, if we consider slices as a
> whole, they are just a sequence of zero or more elements. Null has no
> meaning here.

int[] a = null; // <- :(


More information about the Digitalmars-d mailing list