After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686392 - Allow unowned ref string in foreach loops (possibly useful as general extension)
Allow unowned ref string in foreach loops (possibly useful as general extension)
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Semantic Analyzer
0.18.x
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-10-18 16:24 UTC by Maciej (Matthew) Piechotka
Modified: 2018-05-22 14:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej (Matthew) Piechotka 2012-10-18 16:24:58 UTC
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
Comment 1 GNOME Infrastructure Team 2018-05-22 14:31:09 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/325.