Binding convention for poorly named functions



Aloha,

they shouldn't exist but there are out there: functions that effectively
work on a certain object but that are not prefixed correctly.  There are
zillions of examples:

  * pretty much all of gtk_drag_*
  * pretty much all of gdk_drag_*
  * gdk_draw_*
  * gdk_input_set_extension_events
  * gdk_property_*
  * gdk_rgb_gc_*
  * gtk_propagate_event
  * gtk_selection_add_target, gtk_selection_add_targets,
gtk_selection_clear_targets, gtk_selection_convert,
gtk_selection_remove_all
  * gtk_paint_*
  * gtk_tree_set_row_drag_data, gtk_tree_get_row_drag_data

(Found by looking for non-matching PACKAGE and PREFIX statements in
Gtk2/xs/*.xs.)

And that's only for gtk+, gdk, and pango which have a really well
designed API.  Don't even get me started on libgnomeui.

Since the function<->method war not long ago, muppet has been holding
the view that those should be bound as helper functions, e.g.

  Gtk2::Gdk::Input::set_extension_events($window, ...).

I agree that this would be The Right Way of doing things.  Unfortunately
we already have a lot of functions that are bound differently, e.g.

  $window->set_extension_events(...).

The method approach is pretty elegant from the Perl programmer's point
of view but unfortunately runs the risk of eventually colliding with new
stuff -- after all it inserts a method into a foreign namespace.  The
helper function approach is less elegant but save.

I think we need to decide that issue now.  How are we going to bind
new/unbound stuff that's badly named?

As risky as it might be, I'd vote for keeping up the method approach
simply for the sake of consistency.  And for changing all those bad boys
to helper functions in Gtk3.

What do you all (developers and non-developers) think?

Bye,
-Torsten




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