Widget class loading (was: Re: relase plan, 1st draft)
- From: Joern Reder <joern zyn de>
- To: gtk-perl-list gnome org
- Subject: Widget class loading (was: Re: relase plan, 1st draft)
- Date: Tue, 12 Nov 2002 13:26:56 +0100
Göran Thyni wrote:
Gtk2.pm will be BIG!
and it will bootstrap *a lot* of functions from C.
I think it will still kill startup performance.
Careful evaluation will be needed before
making a change like that.
The balance is between convenience for the developer
and performance for the user (as always).
What about such a solution: each widget class is derived from
Gtk2::Loader (probably a bad name, but Ok for this mail ;)
It has a 'new' subroutine (and probably other different named
constructor subroutines) like this:
sub new {
my $class = shift;
require $class; # or: eval "use $class"; die $@ if $@;
$class->new(@_);
}
Gtk2.pm sets the @ISA array of all widget classes to qw(Gtk2::Loader)
and loads Gtk2::Loader. So when constructing a widget object,
Gtk2::Loader's constructor is accessed first, which loads the real code
and then executes the widget's constructor. Subsequent calls will find
the widget's constructor first, and everything should work with good
performance and as expected.
Just a quick born idea, maybe it doesn't work, because I missed
something essential (also I don't know much about Gtk2's internals).
Just tell me ;)
BTW: how did the Gtk module solved this problem?
Regards,
Joern
--
Joern Reder
supporting: http://www.zyn.de/
unbelievable: http://www.exit1.org/
CPAN: http://www.perl.com/CPAN/modules/by-authors/id/J/JR/JRED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]