Example C vs Julia vs Python

Sorry, I mean array (coming from Python, therefore mixed it up).

compileme([1, 2, 3, 4])

After thinking more about it, it is probably impossible for the compiler to savely assume that the length of an array does not change during loop execution.
Length changes by statements inside the loop could in principle be detected / excluded by the compiler (however, this quickly can get quite complicated). Thread safety is probably an issue: an array passed as argument to a function could in principle be changed during loop execution by another thread.
For mutable types (like tuples) this is not an issue, here the compiler seems to apply the optimization already.