Nick Sabalausky: > > int[3] arr = [1, 2, ...]; > > > > +1...on the condition that such an ability really is all that useful anyway. > (I can't think of a single time I've ever wanted to do that.)
So far I have never had to do it, despite I have written a good amount of Ada-style code in D. I (and others) have suggested that syntax because Walter wants to do that. The solution is to add some symbol that explicitly marks the array as not complete, so both the compiler and the person that later reads the code knows some items are missing. If no item is missing the compiler probably has to generate an error again: int[2] arr = [1, 2, ...]; // compile-time error I think that syntax is explicit and readable enough. A problem with this idea is this syntax is probably not used often. On the other hand leaving that trap in the D language is not good at all. The idea of the dollar symbol can't be used with the ellipsis symbol: int[$] arr = [1, 2, ...]; // compile-time error again Note: for me this syntax with $ is more commonly useful compared to the "..." syntax. Bye, bearophile
