Arrays vs slices

Steve Schveighoffer schveiguy at yahoo.com
Wed Jun 10 20:44:39 PDT 2009


On Tue, 09 Jun 2009 16:22:39 -0400, bearophile wrote:

> Once the language tells apart arrays and slices, the arrays may have a
> third field that represents the capacity, and the slices may have a
> third field that represents the stride (that defaults to 1).

No, please no!  Do I really need to carry around an integer that is going 
to be unused 99.9% of the time (In my case, probably 100%)?  I'd rather 
have a special type that has a stride.

But, the capacity field is good.  I would imagine that is a must for 
appendable arrays.  Would be nice to specify an allocation strategy for 
arrays too, so we can avoid some of the issues being discussed about the 
GC allocating gigabytes for a 40MB array.

-Steve



More information about the Digitalmars-d mailing list