So are a newly allocated array and a null one just the same thing?

    int[] a = [], b = null;
    assert(a == b);
    assert(a.length == b.length);
    assert(a.ptr == a.ptr);

My code made distinction between empty and invalid collections, this mean
that need to track the invalidation on another place?

Pedro Lacerda



2012/2/27 bearophile <bearophileh...@lycos.com>

> Jonathan M Davis:
>
> > Arrays treat null kind of funny.
>
> Seen with the knowledge of today, the D confusion between pointers and
> dynamic arrays was a design mistake.
> Recently a bit of this mess was fixed, now this is a syntax error, thanks
> to Don support too:
>
> void main() {
>    auto a = new int[5];
>    *a = 2;
> }
>
> But I'd like this whole situation to be fixed a bit more.
>
> Bye,
> bearophile
>

Reply via email to