The demise of T[new]

Ary Borenszweig ary at esperanto.org.ar
Mon Oct 19 16:21:16 PDT 2009


Denis Koroskin wrote:
> On Mon, 19 Oct 2009 23:31:37 +0400, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
>> Don wrote:
>>> Walter Bright wrote:
>>>> The purpose of T[new] was to solve the problems T[] had with passing 
>>>> T[] to a function and then the function resizes the T[]. What 
>>>> happens with the original?
>>>>
>>>> The solution we came up with was to create a third array type, 
>>>> T[new], which was a reference type.
>>>>
>>>> Andrei had the idea that T[new] could be dispensed with by making a 
>>>> "builder" library type to handle creating arrays by doing things 
>>>> like appending, and then delivering a finished T[] type. This is 
>>>> similar to what std.outbuffer and std.array.Appender do, they just 
>>>> need a bit of refining.
>>>>
>>>> The .length property of T[] would then become an rvalue only, not an 
>>>> lvalue, and ~= would no longer be allowed for T[].
>>>>
>>>> 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++.
>>>>
>>>> What do you think?
>>>  Since noone else seems to have said it: The fact that you're both 
>>> willing to let it go, after having already invested a lot of time in 
>>> it, is a good sign for the language. Well done.
>>
>> I'm relieved that somebody mentioned that :o). As soon as we gave up 
>> with T[new], people started to sell it to us. We should preemptively 
>> post about eliminating feature plans before actually implementing them.
>>
>> By the way: implementation of @property has been canceled.
>>
>>
>> Andrei
> 
> I *really* hope you told it so that we encourage actually implementing it!
> I strongly believe attributes and properties are very important for D.

Not if the ones that implement it didn't use attributes before or don't 
know what they are useful for or how they could be implemented. :-)



More information about the Digitalmars-d mailing list