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



On Tue, May 11, 2004 at 23:36:29 +0200, Jan Hudec wrote:
On Tue, May 11, 2004 at 15:58:47 -0400, muppet wrote:
[snap]
  use Glib::Object::Subclass
     'SomeParent',
     properties => [
        # follow the default path
        Glib::ParamSpec->int (...),
        {
            pspec => Glib::ParamSpec->double (...),
            getter => sub {...},  # explicit getter
            setter => sub {...},  # explicit setter
        }
        {
            pspec => Glib::ParamSpec->double (...),
            # unspecified getter uses the default path
            setter => sub {}, # explicit setter
        }
     ],
     ;
[snap]

Thinking of it, it can be actualy done in perl. Except the order will
be:
- if there's GET/SET_PROPERTY, invoke it.
- if there's an explicit callback, invoke it.
- use the key in wrapper hash.
Reason for this is, that the getters/setters would be enclosed in the
GET_PROPERTY/SET_PROPERTY closures... Starting to feel like creating
third version of the patch.

Well, actualy the order above is doeable, but it's more magic. In the
CHECK block, rename the GET/SET_PROPERTY and install a wrapper. Not sure
if I feel like doing THAT dirty thing...

I should not underestimate myself. I always feel like writing dirty
hacks. See my post with 3rd revision of the patch. It implements the
above proposal. It is in perl, but I believe it's better to have it
working first. 

-------------------------------------------------------------------------------
                                                 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]