5 ms·
A polyglot's guide to multiple-dispatch (2016)
- lisper 1y agoCue the smug Common Lisp weenies... Oh, wait, that's me :-)
- andsoitis 1y agoPart 3 of this series discusses Common Lisp - https://eli.thegreenplace.net/2016/a-polyglots-guide-to-multiple-dispatch-part-3/ https://eli.thegreenplace.net/2016/a-polyglots-guide-to-mult...
- upghost 1y agoTo your point, I assume the "polyglot" part was referring to the arguments this would spawn in the comment section
- adgjlsfhk1 1y agodon't worry. the Julia peeps can also be smug about this (as one)
- shawn_w 1y agoDiligent Dylan hackers sound off! ... ... ... Bueller?
- sevensor 1y agoHuh, that is cleaner than a giant pattern match. It would be nice to have this at work, I know exactly how I’d use it... Oh no, this is how lisp ruins people, isn’t it.
- gobdovan 1y agoThis is a nice illustration of the expression problem, which the article itself points out toward the end. Multiple dispatch is a language-level way to solve it. Crafting Interpreters [1] has a very approachable Java-based chapter that also covers these patterns in detail. [0] https://en.wikipedia.org/wiki/Expression_problem https://en.wikipedia.org/wiki/Expression_problem [1] https://craftinginterpreters.com/representing-code.html https://craftinginterpreters.com/representing-code.html
- fungiblecog 1y agoif only programmers cared about functionality as much as syntax we'd be living in a lisp heaven
- 3cats-in-a-coat 1y agoYou need some sort of critical majority that cares about deeper aspects of whatever (over superfice) or else everyone focuses on superfice, as that's what all the public debates are about. But lacking that, lisp could improve its syntax (did that, BTW not hard, just added some containers and a few standard infix operators, which all compile to lists).
- Panzerschrek 1y agoAs I know C++ now allows multiple dispatch for std::variant: https://en.cppreference.com/w/cpp/utility/variant/visit2.html https://en.cppreference.com/w/cpp/utility/variant/visit2.htm.... And std::variant is now a better choice for cases like in the article above, where previously inheritance was used to represent a closed set of possible subtypes.
- RossBencina 1y agoWhere "now" means C++17 or C++20 depending on whether or not you understand what INVOKE<R> semantics are?
- maattdd 1y agoTIL that std::visit supports multiple variants. How new is that ?
- MathMonkeyMan 1y agoAlways did, as far as I know. Never knew why...
- ur-whale 1y agoWould have been nice to mention that it's one thing that Julia seem to have gotten right.
- Jtsummers 1y agoIt's a series of articles, Julia is (briefly) mentioned in Part 3.
- eliben 1y agoThanks for posting this! Just a quick note that this post is the first in a series: see https://eli.thegreenplace.net/tag/multiple-dispatch https://eli.thegreenplace.net/tag/multiple-dispatch for the full series