I don't necessarily think that my proposed code is *needed*, instead I think it simplifies the rules of the language, which makes sense to me. Any rule "you can do this in some cases but not others" *will* be a bit arbitrary. Since this should not alter complexity of the language (when the analyser finds the code, it should edit the AST to reduce it to the above code for both C and LLVM)
To illustrate the complexity issue. Imagine this as refactoring steps:
const i32 foo_one = 31;
func void foo()
{
i32[foo_one + 1] array = {
[foo_one] = 1;
}
...
}
"We let's make it more generic!"
func void foo(i32 one)
{
i32[one + 1] array = {
[one] = 1;
}
...
}
"Let's clean it up"
func void foo(i32 one)
{
i32[one + 1] array;
array[one] = 1;
...
}
So more of an enabler of small steps of rewriting. In this case it's trivial, but consider if it's embedded in a bigger context. So it's not that I think it's a good idea for the end code, but code of "least surprise".