Open leonerd opened 2 weeks ago
This change does have the potential impact that, before it, any modifications to the iterated-on array that happen during the body of its own foreach
loop would not get seen, whereas now they would. This is the same issue that single-variable foreach
on a plain array already had, so it's not new. But it is a change for existing code that already calls this function.
Rather than generating an entire temporary list that is twice as big as the original array, instead set a flag on the
OP_ITER
that tells it to set one of the iteration variables to the current array index and use the sameCXt_LOOP_ARY
optimisastion that regular foreach over an array would use.Currently this is a work-in-progress:
builtin::indexed LIST...
should do the same optimisation