TITLE: Simulating "named parameters" [ This is an amusing little snippet on the use of "named parameters". I think this person is asking for a C++ improvement illustrated by void foo (0.5, 5, 10); // traditional C++ call void foo (width:=5, height:=10, epsilon:=0.5); // "improved" C++? -adc ] PROBLEM: ljz@panix.com (Lloyd Zusman) I know C++ is a reasonably "settled" language in terms of its syntax, but I would like to know what you people think about a proposed syntax enhancement: named parameters. RESPONSE: clamage@Eng.Sun.COM (Steve Clamage), 1 Nov 94 This has been submitted as a formal proposal to the C++ Committee three times, and rejected three times. It has been discussed in this forum as well. This feature causes problems and confers little or no net benefit. The major problem is that it causes many more opportunities for ambiguities in overloaded functions. (As if the function overloading rules were not complicated enough already.) What are the adavantages? Ease of writing/reading calls to functions with lots of parameters. In OO programming, functions tend to have very few parameters. Studies have shown an average number of parameters of about 1. With no change in the language you can simulate named parameters in calls to class member functions, like this: class X { ... X(); // the following are probably inline functions X& width(double); X& height(double); X& depth(double); X& count(int); }; // the "parameters" may be in any order and the calls are self-documenting X x = X().width(8.5).height(11.0).depth(0.005).count(500);