On Friday, September 22, 2017 08:19:32 Steven Schveighoffer via Digitalmars-
d wrote:
> On 9/22/17 3:55 AM, Dominikus Dittes Scherkl wrote:
> > On Thursday, 21 September 2017 at 13:58:14 UTC, Timon Gehr wrote:
> >> On 21.09.2017 12:33, Per Nordlöw wrote:
> >>> On Wednesday, 20 September 2017 at 18:41:51 UTC, Timon Gehr wrote:
> >>>>> Can that be done without breakages? -- Andrei
> >>>>
> >>>> No.
> >>>
> >>> Are thinking about
> >>>
> >>>      typeof([1,2])
> >>>
> >>> changing from
> >>>
> >>>      int[]
> >>>
> >>> to
> >>>      int[2]
> >>>
> >>> ?
> >>
> >> Yes, and everything that entails, for example:
> >>
> >> auto x = [1,2];
> >> x ~= 3; // goes from ok to `error: cannot append int to int[2]`.
> >
> > Ok, breaks code, but I like it. Much better than the current behaviour.
>
> Don't fall in love with it. It's not going to happen, as this would be
> too much breakage for almost no gain.
>
> Much as I want a way to statically infer a static array size, this is
> not the answer.

It would also interact horribly with range-based functions. I honestly don't
see any benefit to making array literals be static arrays by default except
for the fact that you'd then get size inference, and there are better ways
to add that to the language if we want to do that.

- Jonathan M Davis


Reply via email to