Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

78 lines (50 sloc) 2.22 kB


Perl 5 MOP - Internals - Dispatching


The next thing we need to discuss is how methods get dispatched. This is fundamental part of any object system and the primary thing which you do with the instances that are discussed in the previous document.

Note that we will allude to classes here, but we won't actually get into the details of them until the next document.

TODO - need to update this to reflect what we are currently doing in the prototype


Is dispatching stash based?


I think it entirely possible that if we were to have proper anonymous stashes whose @ISA and mro can both understand a anonymous stash "object" as well as strings, then it would be possible to compile, upon class finalization, a set of stashes which could be used for dispatching on the new style classes.

This would mean that the above described functions would not actually be executed at runtime, instead the existing built-in method dispatching mechanism would be used.

Not knowing the guts well enough, i am not sure which is really the saner option, to write a whole new dispatching mechanism based on the above described spec, or to somehow try and re-use the existing dispatching mechanism.

I have experimented somewhat with this using the prototype and the Package::Anon experiment created by Florian Ragwitz but have not produced anything successful yet.

Some of the details of this are discussed here:

Florian's Package::Anon experiment is here:



This document contains a section entitled "The problem with Package based dispatching", which discussed my issues with package based dispatching (obviously). This should be viewed only as opinion and not as any guiding principle.


Stevan Little <>


Copyright 2011 Infinity Interactive, Inc.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Jump to Line
Something went wrong with that request. Please try again.