4 ms·
Is this an example of what Mr. Bendersky is talking about? I believe so: https://github.com/perl6/book/blob/master/src/multi-dispatch.pod https://github.com/p
by Diederich 11y ago
Is this an example of what Mr. Bendersky is talking about? I believe so:
https://github.com/perl6/book/blob/master/src/multi-dispatch.pod https://github.com/perl6/book/blob/master/src/multi-dispatch...
- eliben 11y agoFor more context, you may want to check out the first part in the series: http://eli.thegreenplace.net/2016/a-polyglots-guide-to-multiple-dispatch http://eli.thegreenplace.net/2016/a-polyglots-guide-to-multi...
- Someone 11y agoNo. That is overloading with single dispatch. You need multiple arguments for multiple dispatch (they can be implicit, as with the 'this' argument in C++, but they rarely, if ever, are because making one argument implicit makes it look as if the situation is asymmetric in the arguments, and that is exactly something multiple dispatch is not) Edit: oops. I didn't notice that the discussion went beyond the to-json example, which definitely is _not_ multiple dispatch. The discussion starting at the header Multiple arguments is about multiple dispatch.
- arnsholt 11y agoPerl 6 dispatches on multiple arguments based on runtime types, so it's full multiple dispatch.
- raiph 11y agoI thought that, while Perl 6 can dispatch based on runtime types, it does candidate resolution at compile-time for functions (and thus operators) and private methods. It only adds in run-time overhead for these cases if the code uses a run-time type construct. Am I wrong?