On Wednesday, 6 January 2021 at 17:59:57 UTC, Jacob Carlborg wrote:
There's `staticArray` to solve this issue [1].

It does a slightly different thing. staticArray works with types of literals and values, while the proposed way works with type of the declaration. Now you have to either infer the whole type (`auto`) or not infer anything at all. This proposal would let one to infer the length of a static array without inferring it's type. For example, `short[$] arr = [1,2,3]` isn't easily representable with `staticArray`, as `is(typeof([1,2,3].staticArray) == int[3])`.

Whether the issues are different enough to justify a new language feature is another question though.

Reply via email to