Re: gtk2-perl / easily accessing objects properties



Goran Thyni <goran kirra net> writes:

Guillaume,

On Tue, Oct 29, 2002 at 06:03:36PM +0100, Guillaume Cottenceau wrote:
During an irc talk with Manish Singh, he suggested the following
idea (which appears nice to me).
For each object property, instead of either using the generic

        $obj->set(property_name, property_value)

That name is already taken by a similar method:
http://developer.gnome.org/doc/API/2.0/gobject/gobject-the-base-object-type.html#g-object-set
And those are already implemented by you a few day ago :-)
The above exampel should work with your $object->set().

Yes yes, it does work. The point was that it's more short and
straightforward for users to do:

$window->{sensitive} = 1;

rather than:

$window->set('sensitive', 1);
 
or even manually implementing in our classes accessors to have:

        $window->set_allow_shrink(1)

I did this but used:
GET: $window->allow_shrink;
SET: $window->allow_shrink($flag);
which is shorter and cleaner.

Yes you're right. I was more thinking of set_sensitive and the
like functions, sorry.
 
we could change our perl objects so that hash access would be
generic wrappers to automatically call set_property with the
right property name and value, giving the following use:
        $obj->{sensitive} = 1
needs a tie or a copy, 

yep.

which slows down start time even if we don't use it

do you think the slowdown is measurable? (I haven't made tests
and haven't got significant experience on that topic)


-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



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