Hello,

I have come across this weird closure thing.  In other programming
languages, I would expect the closure in t to have a copy of i, but it
only has a reference.  Is it expected?

Best regards,

Vivien


public delegate void Thunk();

public static void run (Thunk t) {
        t ();
}

int main() {
        int i = 0;
        Thunk t = () => {
                stdout.printf ("%d = 0, right?\n", i);
        };
        i = 1;
        run (t);
        return 0;
}
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to