Resizable Arrays?

Jason House jason.james.house at gmail.com
Sat Feb 28 19:43:28 PST 2009


Sean Kelly Wrote:

> Jason House wrote:
> > Are there any good reasons to allow built in arrays to be resizable?
> > 
> > There's already plenty of empirical evidence that building arrays by appending is incredibly slow.
> > 
> > There are also bugs in bugzilla where resizing arrays after assigning one array to another violates type safety. Those bugs can be solved by always reallocatimg arrays when resizing, but that makes performance even worse...
> > 
> > While not much of an argument, C# also prevents array resizing.
> > 
> > Is it time to rely on standard libraries for data structures and let built in arrays be fixed length? It's a breaking change... 
> 
> C has dynamic arrays now.  If D got rid of them I might just cry.

By dynamic, do you mean no length as part of the type or resizable in place? Array resizing can lead to hidden allocations, which is against Tango design (my closest proxy for your style preferences). My past use of arrays in C did not include calls to reallocate them in place. 



More information about the Digitalmars-d mailing list