Am 21.06.2010 09:29, Fredderic Unpenstein wrote: > On 21 June 2010 01:57, Frederik <scumm_fr...@gmx.net> wrote: >> GLib/GObject 2.26 will add property binding [1]. The straightforward way to >> support this in Vala would be: >> Object.bind_property (foo, "x", bar, "y"); >> Object.bind_property (foo, "x", bar, "y", BindingFlags.BIDIRECTIONAL); > > Would foo.x.bind_property be a possibility? And perhaps > bind_bidirectional or bind_with (do you bind anything else, other than > properties, on an object property?)... Maybe then also bind_property > could become bind_to or something equaly less redundant?
A problem is that 'foo.x' will evaluate to the value of the property, not representing the property itself. So, if you write foo.x.bind_property (bar.y); and if 'foo.x' is 4 and 'bar.y' is 5 it would essentially mean 4.bind_property (5); > Personaly, I like the operators, but they're a little limited once you > add extra varients or options, as with the connect family. Unless > some syntax is added for general operator functions... eg: > > foo.x +> [BIDIRECTIONAL] bar.y; > > which could also make += signal connection useful again. Perhaps > adding support for a bracketed comma-separated list with the extra > arguments, instead. Personally, I prefer descriptive names over symbolic operators. The question is whether the property binding feature is essential enough to justify extra syntax (keyword, operator) just to be type safe. >> And how to deal with 'g_object_bind_property_full'? It takes two >> TransformFuncs >> but only one user_data/GDestroyNotify pair. >> (foo.x, celsius_to_fahrenheit) <+> (bar.y, fahrenheit_to_celsius); >> (foo.x, (b, s, t) => { }) <+> (bar.y, (b, s, t) => { }); > > That's sort of what I was saying with bracketing above, too. A > general syntax pattern like that might help with other places where > syntactic support would be useful but presently shunned. > > > Fredderic > Best regards, Frederik _______________________________________________ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list