D array expansion and non-deterministic re-allocation

Steven Schveighoffer schveiguy at yahoo.com
Thu Nov 19 05:21:17 PST 2009


On Thu, 19 Nov 2009 07:32:03 -0500, Denis Koroskin <2korden at gmail.com>  
wrote:

> Slices are ranges. And ranges are *shrink-only*. Are you going to append  
> to your data structure? Use an Array instead. Slices are not suitable  
> for that purpose!

Arrays are ranges too.  Just because the range interface does not define  
operations that allow growth doesn't mean that something that implements  
the interface *can't* add growth methods.

I see no problem with slices and arrays being the same type, as long as  
the stomping problem is solved.

-Steve



More information about the Digitalmars-d mailing list