Hasty Briefsbeta

A polyglot's guide to multiple-dispatch

4 days ago
  • #programming
  • #multiple-dispatch
  • #C++
  • Introduction to multiple dispatch as an advanced abstraction technique in programming languages.
  • Explanation of single dispatch vs. multiple dispatch, with examples in C++.
  • Demonstration of a failed attempt to implement multiple dispatch in C++ using overloading.
  • Presentation of the visitor pattern as a solution for multiple dispatch in C++.
  • Discussion on symmetry and base-class defaults in multiple dispatch implementations.
  • Critique of the visitor-based approach for being intrusive and hard to maintain.
  • Introduction of a brute-force approach using dynamic_cast for multiple dispatch.
  • Mention of Andrei Alexandrescu's work on automating multiple dispatch with templates.
  • Overview of Bjarne Stroustrup's proposal for language-level support of multiple dispatch in C++.
  • Conclusion highlighting the trade-offs of different multiple dispatch solutions in C++ and teaser for future articles on other languages.