Re: Installing Glib::Object::Introspection


On 17 January 2015 at 15:34, Ed . <ej_zg hotmail com> wrote:
You would need a .pm for each .xs file. The plus side is that when users
"use" a module, they would only load that one and not inhale everything

I know some people favour this approach, but *in general* is based on
wildly wrong assumptions on how *everything* works in any modern OS,
and *especially* when it comes to high level language wrappers around
C-based libraries.

splitting up Glib or GTK bindings on a one-Perl-module-per-C-type is
pretty much pointless, since Glib is going to be loaded anyway the
first time you load a Glib::* sub-module, and that dominates any other
metric you can think of. you'd also load a ton of small .so wrappers,
each likely smaller than a memory page, which will make loading time
and memory use actually go up, instead of reducing them.

once you loaded libglib-2.0.*, you may as well expose every bit of the
API. considering the interdependencies between bits of the API (e.g.
all types in Glib are exposed as GTypes, which means they need
libgobject-2.0.* to be loaded as well), various Glib::* sub-modules
will end up not only loading other Glib::* sub-modules as well, but
will do so in the global namespace given that they expose that API.

the above scenario is even worse for Gtk. if you use a
Gtk2::RadioButton, you'll immediately get: Glib::Object, Gtk2::Widget,
Gtk2::Container, Gtk2::Button, Gtk2::ToggleButton, and
Gtk2::CheckButton loaded as well. you'll also likely get Gtk2::Label,
Gtk2::Image, and Gtk2::Box loaded as well — and that's all in the
global namespace, because those types/modules are exposed in the API.

finally, it would run counter to how Glib is used in every other
language, from C, to Python, to JavaScript, to whatever; and it would
also run counter to how the API is designed.

tl;dr: splitting up Glib or Gtk2 into one-package-per-type scheme is
based on wrong assumptions and has only drawbacks.


[ ] ebassi [ gmail com]

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