Consider the following
arr = [5, 4, 3, 2, 1]
arr.each_with_index { |val, index| dosomething...}
Based on my readings Ruby will iterate across the array in sequential order (5, 4, 3 ...). My question is whether this behavior is guaranteed by the language or its specification? Specifically would future versions of Ruby prevent the array from being iterated in parallel or in a different sequential order? Put differently is the sequential processing of array elements by an each function call CONVENTION or SPECIFICATION.
Let's look at these two topics separately.
Non-sequential order: Could future versions of Ruby, without violating the language specification, possibly decide that the optimal way to accomplish execution of the each_with_index is [2, 3, 5, 4, 1]?
Parallel processing: Consider a future (or perhaps existent but unknown to me) version of Ruby for large scale parallel processing. Without violating the language specification could this version of Ruby potentially decide to process 3, 2, and 1 at the same time and then after that 4 and 5?
Appreciate the feedback.