[Vala] GBinding support?



Hi,

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);

However, this is not very type-safe. Would direct language support be
reasonable? E.g. something like

  foo.x +> bar.y;       // default
  foo.x <+> bar.y;      // bidirectional

Or is it too cryptic?

And how to deal with 'g_object_bind_property_full'? It takes two TransformFuncs
but only one user_data/GDestroyNotify pair.

And how could syntax support, if any, look like?

  (foo.x, celsius_to_fahrenheit) <+> (bar.y, fahrenheit_to_celsius);
  (foo.x, (b, s, t) => { }) <+> (bar.y, (b, s, t) => { });

?


Best regards,

Frederik


[1] http://library.gnome.org/devel/gobject/unstable/GBinding.html



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