Allow unowned ref string in foreach loops (possibly useful as general extension)
@mpiechotka
Submitted by Maciej Marcin Piechotka Link to original bug (#686392)
Description
Consider loop:
for (uint i = 0; i < array.length; i++) { array[i] = 0; }
One could turn it into (syntax assume similar extensions as one in bug #638199):
foreach (ref var el in array) { var = 0; }
Proposed solution:
- For arrays it treats the iteration variable as pointer as if in ref argument
- For iterators it would call set function if it exists for store
- For "lists" syntax it would call set function if it exists for store
- (see proposed solution for bug #645850) For functional iteration I can add virtual function to ListIterator
Version: 0.18.x