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



Please allow me to argue both sides of the issue here, butting my head in where it doesn't belong and where there probably is no room for it...

Marc Lehmann wrote:

On Thu, Jan 08, 2004 at 08:55:51AM -0500, Ross McFarland <rwmcfa1 neces com> wrote:
once again the filename stuff obviously isn't the best example, but some good
examples (of places where class static functions have to be accessable though

Yes, the example is flawed because new methods are new _methods_.
Perhaps a better example (but still somewhat contrived) would be one where the programmer wanted to add some functionality to e.g. filename_from_unicode.

package MyGlib;
require Glib;
our @ISA = ('Glib');
sub filename_from_unicode {
   my ($class, $name)  = @_;
   $name = $class->SUPER::filename_from_unicode ($name);
   # Do something more
   return $name;
}

Including the class name doesn't buy you much, but it does allow you to chain method calls to the parent class without repeating the info in @ISA in the actual call.

Not to say that I want the class method syntax, just that it could be argued both ways.

There *is* an extra argument involved in the 'class->class_method' syntax versus 'class::function', and that argument (the class name) knows about inheritance, it's not just a stupid string.

Bjarne





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