The demise of T[new]

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Oct 19 12:23:41 PDT 2009


Leandro Lucarella wrote:
>>> I don't see much problem. You should always return an array (T[new]) if
>>> you have one, because you can get an slice from it (the inverse is not
>>> true). Because of this, implicit conversion from array to slice can be
>>> a good idea, so people expecting a slice when an array is returned will
>>> never know an array was returned anyways. If you need to keep appending to
>>> the array, you can have the original array and keep appending to it
>>> without any performance hit (no copying, no new allocations).
>>>
>>> What's wrong with that?
>> People expecting a slice and using "auto" or templates are in for a
>> rude awakening.
> 
> Ok, you are in one of those days when you don't listen to reasons. I give
> up! =)

At least in that case I had an objective point! I'd agree many others 
are subjective.

Andrei



More information about the Digitalmars-d mailing list