develooper Front page | perl.perl5.porters | Postings from April 2007

mro callbacks patch

Thread Next
From:
Brandon Black
Date:
April 23, 2007 16:15
Subject:
mro callbacks patch
Message ID:
84621a60704231615i6f953537sb2542eecd6ce765e@mail.gmail.com
Attached is a further extension of the mro.c stuff, done after a
discussion on #moose about making life easier for things like
Class::MOP.  This adds the ability for meta-level code like Class::MOP
to register a callback with the core to be notified when methods or
@ISA are modified in a given package.  It supports multiple
registrations in case one is using multiple modules that want to use
this.

I had originally intended that Class::MOP-like things should be able
to introspect this sort of state by querying the package-level
sub_generation and isa_generation numbers via mro:: interfaces, but in
the interest of a more efficient implementation for the core's method
caching, isa_generation doesn't even exist anymore, and the
package-level sub_generation doesn't really indicate the most useful
thing for userland (it indicates that method caches have been
invalidated for this package, which is substantially different than "a
real method has changed IN this package").

-- Brandon

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About