On Fri, Mar 07, 2003 at 01:35:02AM +0100, David Hedbor @ Pike developers forum wrote:
Using a mapping with some construct that enforces entry names might work but I don't see the benefit.
the benefit would be that this type checking would be usefull in other situations too.
what I like about named parameters is that you keep the simplicity (in the method) of normal parameters - there's no difference.
well the difference is that they are named, vs. unnamed.
however on a different note, going back to your suggestion, actually:
void foo(string firstname="", string initial="", string lastname="");
is not needed at all to get named parameters, they are already named: you really only need this:
void foo(string firstname, string initial, string lastname); foo(firstname = "David", lastname = "Hedbor")
as a generally acceptable syntax to assign the values. i don't see a need to define the variables in a different way to make assigning them like this work.
void foo(string firstname="", string initial="", string lastname=""); would still be usefull, but for a different unrelated purpose, namely asigning default values, which was discussed in another thread.
greetings, martin.