Re: gtk2-perl: classname functions



Le mar 17/12/2002 Ã 15:29, goran kirra net a Ãcrit :
Daniel added resolution of Gnome2 and Gnome2::Art 
classnames Gtk2::_Helpers

That is OK in the short run,
but this is not a generalized enough 
because adding new modules are impossible
without changing a core class.

I was thinking this over and we need some kind 
of registration mechanism instead of the hard code
class handlers.
Ideas, objections?

I also think this will be better.

A simple way to do it is to have a hash table in Gtk2::_Helpers. This
htable will translate for the GType class name to our package name
system.

All package can add an entry in this hash table. This can be done
automatically into Gtk2::_config.

Like this, in Gnome2, I can add what I want without having to modify
Gtk2::_Helpers.

The possible only problem. Is that class will only be registred when we
use them. So if a function return an object which depends on a class not
already used, the type convertion will not work. This just because the
type was not already registred by the class.

To solve this problem, we can declare all type convertion (filling the
hash table) in one file always loaded (for example, Gtk2::_Helpers for
Gtk2 and Gnome2::_Helpers for Gnome2 and other for different projects).
I have no other good idea for this problem.

What we can also do is to have conversion rules with regular
expressions. Those expressions will be placed into the hash table. I
don't find this good because we can easily do mistakes.

/gÃran

Daniel




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