Passing function parameters by name
Artyom Shalkhakov
artyom.shalkhakov at gmail.com
Tue Dec 4 01:52:21 PST 2007
Hello everyone.
I suggest adding a new syntax for function parameter passing. To illustrate:
void foo( int a, float b ) {
// some code
}
void main() {
foo( 1, 2.5f ); // classic
foo( b : 2.5f, a : -3 ); // sort of struct initializer
}
Since named arguments can be passed in any order, they can be especially useful when a function has more than one parameter with a default value.
This concept could be applied to template instantiation as well.
-Artyom Shalkhakov
More information about the Digitalmars-d
mailing list