Re: [RFC][PATCH] Small enhancement for Glib::Object::Subclass




Jan Hudec said:
Now, why I don't like such code:

1) It's a repetitive code. It will be the same for each subclassed
   widget, except for the property names. Such code should be
   autogenerated, or not needed at all.
2) The property name appears in more places than strictly necessary,
   which makes it a bit more prone to error. When you change something,
   you have to keep in mind where else the name appears. And, unlike C,
   perl won't check for you.
3) It encourages long functions. Long functions are hard to reader to
   read and harder to debug.

agreed.


And one more argument is, that the current implementation is mostly
useless (properties are mostly useful exactly because they have
getter/setter). I try to make them useful for more cases.

i'm rather fond of the bounds-checking and documentation facilities, and the
fact that if you create properties, you get to use a perl-ish new, gratis, and
don't need to create accessors, and then they feel just like the Glib::Objects
with which they interact.

   $foo = Foo->new (one => $one, two => $two);
   $foo->set (three=>$three, one=>$other_one);




-- 
muppet <scott at asofyet dot org>



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