Re: A couple of small bugs + patches



-

ill leave it to paolo too, but in my opinion is it better to leave it as
a GtkWidget.  what if it *ISNT* a GtkMenu (for whatever reason), the only
thing that every object *must* be in Gtk is a GtkWidget (ok, sure a
GtkObject, but thats opaque).  but whatever.

From: Dave Carrigan
Subject: Re: A couple of small bugs + patches
Date: 28 Feb 2001 20:27:00 -0800


"Charlie Schmidt" <ishamael themes org> writes:
 
 > it makes perfect sense in C, as Gtk+ has its own object system.
 > it returns a GtkWidget, but you can just use the macro:
 > 
 > GTK_MENU(widget); 
 > 
 > to cast it as a menu.
 > 
 > i think that the bindings should be as accurate as possible so:
 > 
 > bless(bless $objectmenu->get_menu, 'Gtk::Menu');
 
 After thinking about this for a while, I think that this is not a good
 idea.
 
 In an object-oriented system, an object should know what kind of class
 it is. The programmer should never have to cast an object into its
 correct class; the language should take care of that. Just because C
 programmers are forced to do this doesn't make it right; it just
 demonstrates that the C language does not have much support for
 object-oriented design.  Since gtk-perl is able to bless a Gtk object
 into its real class, it should do so.
 
 This is especially true in consideration of the fact that a Gtk::Menu
 ISA Gtk::Widget, so returning a Gtk::Menu will not affect any programs
 that are expecting a Gtk::Widget.
 
 I will leave it up to Paolo, but, IMO, unnecessarily forcing Perl
 programmers to bless objects into the correct class is a bad design.
 

-- 
Charlie Schmidt - <ishamael themes org>





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