Re: Widget class loading (was: Re: relase plan, 1st draft)



goran kirra net wrote:

There is a base global class: "Gtk2::_Object"

Yes, then it's probably a candidate, but only if Gtk2::_Object itself 
has no constructor (so we can put our load-on-demand stuff in it, 
without overiding anything).

But I think, we should introduce a new class for that. It's very small,
and only has these few loader subroutines for each possible constructor
name (new, new_with_label etc.)

How do you know what @ISA contains before the module is loaded?

This doesn't matter. On startup the @ISA contains only "Gtk2::Loader" 
(or whatever the name is). Note: no widget class is loaded yet, only the
@Gtk2::WidgetXYZ::ISA variable exists. When Gtk2::WidgetXYZ->new is 
called, Perl will find Gtk2::Loader's constructor, loads the real widget
class (which overrides the existent @ISA variable with its real values),
and from now on, the prior inheritence of Gtk2::Loader disappeared 
completely and everything should be exactly like loading the widget 
class with "use" or "require" directly.

It's simply modifying the inheritence of a class at runtime. I'm not 
sure, how many programming languages support that, but Perl indeed does!
;)

Regards,

Joern

-- 
sub i($){print$_[0]}*j=*ENV;sub w($){sleep$_[0]}sub _($){i"$p$c > ",w
1,$_=$_[0],tr;i-za-h,;a-hi-z ;,i$_,w 1,i"\n"}$|=1;$f='HO';($c=$j{PWD}
)=~s/$j{$f."ME"}/~/;$p="$j{USER}\ $j{HOSTNAME}:";_"kl",$c='~',_"zu,".
"-zn,*",_"#,epg,lw,gwc,mfmkcbm,cvsvwev,uiqt,kwvbmvb?",i"$p$c > ";w 99




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