But why though? What is the purpose of the immutable "dynamic" array in your D?
We're unavoidably going to learn at compile time how big the array is, and knowing how big it is will always be the same or better, so we should always do that.
If you know at compile time what the size should be:
int[f().length] array;
If you know at compile time what the size should be:
should do it.