On Tue, May 11, 2004 at 21:11:05 +0200, A. Pagaltzis wrote:
* Ross McFarland <rwmcfa1 neces com> [2004-05-11 20:34]:basically my question is what is insufficent/wrong about doing things like this:Lack of abstraction. A more declarative mechanism would be nice to have.rather than having the extra overhead of looking for the sub with the upper cased version of the property name.I don't particularly like it either. Magic names are almost never an optimal interface. I'd prefer having a method to register coderef callbacks for accesses to given property names; the $self->can() check would then be replaced by a simple hash lookup on the property name. Much cleaner, barely any extra overhead.
GET_PROPERTY and SET_PROPERTY are magic names too ;-). Just like INIT_INSTANCE and others. And just as do_<signal_name>, which is already used for signal closures! So you see, it's rather consistent with the rest of the interface. Registering is of course possible, but it: 1) Does not look perlish. Perl seems to prefer magic names. 2) Is actualy more work. If the UNIVERSAL::can is replaced with simple namespace lookup, it's almost no overhead either. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb ucw cz>
Attachment:
signature.asc
Description: Digital signature