The demise of T[new]
Denis Koroskin
2korden at gmail.com
Mon Oct 19 10:21:46 PDT 2009
On Mon, 19 Oct 2009 20:16:50 +0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> I thought I explained that above and in several other posts. I have the
> feeling this is going in circles, but let me add one more thing. People
> would want to have a reasonable way of choosing between T[new] and T[].
> The differences between them are subtle (I have two tables showing the
> primitives of T[] and T[new], which are very similar). That static
> decision concerns future appends to the array, which doesn't strike me
> as something you know from the get-go through future iterations of a
> design. Use of "auto" messes up things further: a nice function may
> choose to return T[new] because it just created an array (an
> implementation detail), but clients may find that unexpected.
>
>
Put it simple: T[] is a range, and T[new] is a container. They belong to
different leagues.
Yes, there is a lot common between them, because T[] supports some subset
of operations that T[new] support.
We are going in circles because you couldn't convince anyone that we don't
need dynamic array type in language core. Not unless library types are
usable in CTFE (and have nice syntax).
More information about the Digitalmars-d
mailing list