Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why there are no multimethods in c++? [closed]

I read many article about how to implement multimethod in c++:

  1. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1529.html
  2. http://www.codeproject.com/KB/recipes/mmcppfcs.aspx
  3. http://lambda-the-ultimate.org/node/2590
  4. http://parasol.tamu.edu/people/peterp/omm/

why there are no multimethod in c++?

why do not they get supported by c++ standard?

like image 558
Ritardi Giuseppe Avatar asked Jan 30 '11 18:01

Ritardi Giuseppe


2 Answers

Just because it could be done doesn't mean it's a problem that it wasn't done. One criticism of C++ is along the lines of "Stroustrup took everything anyone had heard of, and tried to include it."

Plus, as Raymond Chen says, "Every feature starts off with -100 points." That is, before you ask why C++ doesn't have these things, you should explain in detail why it needs them. Otherwise your feature stays in negative territory, due to the costs associated with it.

like image 191
John Zwinck Avatar answered Sep 22 '22 15:09

John Zwinck


Straight from the horse's mouth:

"I rejected multi-methods with regret, because I liked the idea, but couldn't find an acceptable form under which to accept it."

Bjarne Stroustrup, The Design and Evolution of C++ (p297)

And later:

"Multi-methods is one of the interesting what-ifs of C++. Could I have designed and implemented them well enough at the time? [...] What other work might have been left undone to provide the time to design and implement multi-methods?"

(p298f)

In general, whenever you feel the urge to know why some particular C++ feature was implemented, or was not implemented, or was implemented the way it is now, and if that feature pre-dates the standardization, you want to read D&E.

like image 33
sbi Avatar answered Sep 22 '22 15:09

sbi