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




On Tuesday, May 11, 2004, at 05:36 PM, Jan Hudec wrote:

Thinking of it, it can be actualy done in perl.

well, yeah, it can, but then it would only be available via Subclass.pm (unless register_object is moved to perl). the XS implementation would actually be quite easy, and would have equivalent functionality without requiring lots of repetitive *generated* code.


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

perhaps i wasn't clear enough; the order has to be explicit [sg]etters first, or the generic GET/SET_PROPERTY will always override them. and by providing the default behavior (using the hash key) as the fallback, the need for the CHECK block in Subclass.pm magically goes away[1], and we won't actually *need* the GET/SET_PROPERTY functions. however, we must preserve the ability to use them, as we cannot break compatibility with any existing code.

getting rid of the CHECK block will actually make Subclass.pm more universally useful.


[1] well, provided we can find a way to handle new(), but since new() is inheritable, this should be an easy @ISA hack.

--
"it's hard to be eventful when you have this much style."
   - me, rationalizing yet another night of sitting at home.




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