Re: [RFC] Glib::filename_(to|from)_unicode => Glib->filename_(to|from)_unicode?



muppet wrote:

Two functions in Glib, added right before 1.020, do not follow the
calling conventions of just about every other function in Gtk2-Perl.

 string = Glib::filename_to_unicode string
 string = Glib::filename_from_unicode string

These require that you use a fully-qualified name for the functions,
rather than allowing class parameters (the arrow syntax).  These
*should* be callable as

 string = Glib->filename_to_unicode(string)
 string = Glib->filename_from_unicode(string)
I have to agree with Marc on this one, although not with quite the same passion. If they look and act like functions, there is no shame in letting them look and act as functions in perl. Actually, this is preferrable to letting them look and act like class methods, which they are not, not in function anyway. Think of the equivalent syntax for class methods:

   $string = filename_to_unicode Glib 'string';

Looks kinda silly, doesn't it...

If you're bothered by the length of the qualified name, you could consider adding them to @Glib::EXPORT_OK, and let users access them without the qualification. Again something which is natural to do for functions, but not for class methods.

On the other hand, looking at the implementation, they don't seem to do very much (or anything at all), nor do they have an equivalent in glib. What's the point of implementing them at all? Shouldn't they just be dropped?

Bjarne




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