The demise of T[new]
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Oct 18 19:50:42 PDT 2009
Jason House wrote:
> Andrei Alexandrescu Wrote:
>
>> grauzone wrote:
>>> Walter Bright wrote:
>>>> We both feel that this would simplify D, make it more flexible,
>>>> and remove some awkward corner cases like the inability to say
>>>> a.length++.
>>> How would this remove this corner case?
>> Can't increment length if it's read-only.
>>
>> Andrei
>
> removing syntactic sugar doesn't really remove corner cases. T[new]
> is being replaced with an array builder. What usage semantics are
> given up with an array builder? How will implicit conversions be
> handled? (alias this, etc...). How will the Phobos array buiilder
> support user specified lengths (for efficiency)?
I think ArrayBuilder could a logic similar to Appender for "~=" and
otherwise offer regular array primitives. I don't think implicit
conversion to T[] is an essential feature, but it can be done.
Andrei
More information about the Digitalmars-d
mailing list