Improved optimization of foreach loops so that it extends to
multi-dimensional arrays as well as single dimensional arrays.

Added mechanics so that arrays can also be cast to interfaces of
Array<T>, such as CanIterate<T>.