"bearophile" <[email protected]> wrote in message
news:[email protected]...
>
> It seems Pull 375 also turns this program in a compile-time error:
>
> int[3] arr = [1, 2];
> void main() {}
>
> Walter told me that this code used to work as designed, this means it's
> not a bug.
> Despite not being a bug, I think accepting that kind of code is a
> bug-prone anti-feature.
>
> There are two little enhancement requests related to this (not currently
> implemented in Pull 375): Walter wants this code to work because in some
> uncommon situations he wants to be free to specify less items than the
> whole array:
>
> int[3] arr = [1, 2];
> void main() {}
>
>
> The Python Zen says "Explicit is better than implicit.". Being explicit
> allows Walter to do what he wants, and allows me to avoid the bugs too.
>
In general, I consider Python Zen to be a load of puritanical BS (no offence
;)). But I definitely agree that the ability to do "T[n] x = [ {<n} ];" is a
terrible hidden landmine.
> So I (and other people) have suggested this syntax for the uncommon
> situations where you want to specify less items:
>
> 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.)