The demise of T[new]

Stewart Gordon smjg_1998 at yahoo.com
Fri Oct 30 09:37:24 PDT 2009


I've just caught up on this thread.  Built-in dynamic arrays have been 
one of D's major features since the early days.  Now you're planning to 
remove this feature?

http://www.digitalmars.com/d/1.0/builtin.html
states that the C++ STL has many types that have been created to 
compensate for the limitations of the built-in array type, and the power 
of D's built-in arrays largely eliminates the need for these.  So now 
you're suggesting that we do away with this power, and create these 
library types that the point was to avoid?

Walter Bright wrote:
<snip>
> The .length property of T[] would then become an rvalue only, not an 
> lvalue, and ~= would no longer be allowed for T[].

I thought you were already moving that functionality into T[new].

I think T[new] versus T[] is actually a good design - it makes for a 
form of array length constancy as well as possibly getting rid of such 
nasties as bug 2093.

> 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++.

I must've missed the discussion - what's wrong with fixing such 
expressions to work in terms of property setters/getters in the natural way?

Stewart.



More information about the Digitalmars-d mailing list