(Note: throughout this message, "method" refers to "sub"s and "submethods" as well.)

I'm having trouble coming up with a solid argument for why Single Method Dispatch (SMD) is our default, when we have MMD.
At this point, I'm tempted to slap a C<multi> in front of all my methods, for the sake of future extensibility.


So my basic idea is to solicit reasons why we shouldn't make C<multi> the default, and then allow for c<is SingleDispatch> for the obscure cases where one wants such behavior.


Arguments in favor:


= If you've bothered to define a signature for the method, you expect things that call it to match that signature. I would expect an error when I tried to call a method with parameters that didn't match the signature. This change would move that error from "Call doesn't match signature" to a "Method for name(signature) not found".

= If you haven't defined a signature, MMD will match against the implied signature, which it always should, so no problem.

= Making everything multi makes extending existing code much easier, for obvious reasons.


Arguement against:


= Likely makes things harder on the optimizer. Or more likely, makes MMD optimization a lot more important. But that's a p6i problem, not a p6l one.


Another way to interpret this post is "When is SMD preferred over MMD? And is that enough to make it the default?"



If I'm missing something basic feel free to correct me.


-- Rod Adams

Reply via email to