Given this:

for (int i=0; i < 10; i++) {
    button[i].clicked.connect ((s) => {stdout.printf ("%d\n", i);});
}

all the buttons, when clicked, outputs 10.
i.e., the variable i is treated as non-local and shared
by all those closures.

Is this the correct semantic?

If this is up for debate I would say that this is
a wrong semantic. Different iteration of the for loop
should use "different" i.

hand
Nor Jaidi Tuah

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to