Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 78 lines (50 sloc) 2.22 kb

NAME

Perl 5 MOP - Internals - Dispatching

DESCRIPTION

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

NOTES

Is dispatching stash based?

Perhaps.

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: http://www.nntp.perl.org/group/perl.perl5.porters/2011/09/msg177099.html

Florian's Package::Anon experiment is here: https://github.com/rafl/package-anon

RELATED

100-rants.pod

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.

AUTHOR

Stevan Little <stevan.little@iinteractive.com>

COPYRIGHT AND LICENSE

Copyright 2011 Infinity Interactive, Inc.

http://www.iinteractive.com

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

Something went wrong with that request. Please try again.