On Monday, 11 January 2021 at 14:42:57 UTC, Nick Treleaven wrote:
[snip]

Just a suffix like `[1,2]$` or `[1]s`. Then just use `auto var =` with it as normal.

Gotcha. I think I would use that more than the current DIP (though I prefer [1]s to [1]$).

Of course, the typical response would be, "well why not use alias s = static array". I would ask what about an @nogc unittest where the author is trying to limit calls to functions that aren't really central to what is being tested. The next best alternative is something like `enum immutable x = [1];` and then using `x`. Building that static array literal functionality into the compiler would be useful in that case.

Reply via email to