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

On Tue, 2004-05-11 at 14:32, Ross McFarland wrote:
Jan Hudec said:
Hello All,

When subclassing a widget, it's probably not uncommon that setting or
getting at least one property needs to be treated specialy, but for some
other properties the default behaviour (just storing it in the hash) is
ok. Or perhaps even for the special property get can do with the default
implementation. Therefore I suggest following enhancement for the

<look ma, no code>  I had implemented something similar, via the
AUTOLOAD function.  If I had a hash member name, I could just use
$obj->MEMBER($value) or $obj->MEMBER() to set/get the attribute.  If I
needed to overload for something special, all I had to do is implement
the 'sub MEMBER {...}' in the proper class.

That even worked well when stuff got deprecated, and I wanted to supply
compatibility functions to use new members appropriately.

If I'm not mistaken, then $self->SUPER::MEMBER() will eventually find
the AUTOLOAD, so it was pretty seamless. 

<look ma, no code/>

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