The demise of T[new]

Bill Baxter wbaxter at gmail.com
Tue Oct 20 11:43:16 PDT 2009


On Tue, Oct 20, 2009 at 11:30 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Steven Schveighoffer wrote:
>>
>> If your goal is to affect the original array, then you should accept a ref
>> argument or not append to it.
>
> I think that's an entirely reasonable (and easy to explain) stance.

I've definitely spent time tracking down exactly such bugs, where I
meant to make the argument a ref but didn't.  If the above is to be
the official stance, then I think it should be enforced by the
compiler.  Appending to non-ref slice args should be an error.

--bb



More information about the Digitalmars-d mailing list