[Vala] feature request + proposed patch: infer enum scope from expected type



Dear vala-developers,

(I'm resending this e-mail that went to vala-list before, as it seems
more appropriate here.)

I thought it would be nice if it was possible to write:

   A.bind_property("prop", B, "prop", SYNC_CREATE|BIDIRECTIONAL);

and not having to specify the scope GLib.BindingFlags:

   A.bind_property("prop", B, "prop",
GLib.BindingFlags.SYNC_CREATE|GLib.BindingFlags.BIDIRECTIONAL);

I have written a small patch taking care of that, and posted it at
bugzilla [1]. There's a .vala file with testcases too.

The case of a single enumeration value is a very minor change: it only
affects code that used to give a compiler error. However, the case of
flags has to change the way that the operators | and & use their
target value. I cannot really oversee whether this will give new
problems.

I'd love to hear your feedback!

Best regards,
Timo Kluck


[1] https://bugzilla.gnome.org/show_bug.cgi?id=666035


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]