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



On Tue, May 11, 2004 at 15:26:13 -0400, muppet wrote:

Jan Hudec said:
If SET_<property-name>/GET_<property-name> method exists, it is called.
Otherwise, the property is set to/retrieved from the hash.

I would actualy like set_/get_ prefixes better (such methods are more
suited to be called directly), but the following patch uses SET_/GET_
because that is less likely to break existing stuff.

most objects already have accessor methods named get_$name(), which will
invariably have different call signatures and could possibly result in
infinite recursion.  so, aesthetics must take a back seat.  :-/

i could say <handwaving>magical names like that open up lots of opportunity
for name clashes in the future</handwaving> but i'm not really *that* opposed
to the idea.

on the other hand, armed with the knowledge that Subclass.pm's
GET|SET_PROPERTY cannot be used in a file that is 'require'd rather than
'use'd, thanks to the usage of CHECK blocks, is it still important?  (that is,
you'll have to provide an implementation of GET|SET_PROPERTY anyway.)

Wow. I didn't bother too much trying to understand the import method for
the first time. But now I see! Since the import method knows all
property names, it can generate the GET/SET functions for all of them --
and we are there, and no overhead... I'll try to do THAT (mainly because
I like writing smart hacks in perl).

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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