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

mro callbacks patch

Thread Next
Brandon Black
April 23, 2007 16:15
mro callbacks patch
Message ID:
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

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About