From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-19 13:52:26


>From: "Edward Diener" <eddielee_at_[hidden]>

> "David Abrahams" <dave_at_[hidden]> wrote in message
> >
> > Oh, it's a problem alright, but I'm still not very convinced of that
> > solution. The problem with interfaces that have lots of positional
> > parameters is that you forget what the different positions mean. To
> > solve that problem, you need either named parameters or a
> > position-independent interface.
>
> Since the C++ language already has embraced positional parameters as its
> normal means of passing information to functions, classes, or templates,
it
> is a little disingenuous to complain about them. Every function call is
> essentially a matter of knowing "what the different positions mean". Since
> we are stuck with this metaphor, so to speak, we can at least make the
best
> of it in regard to default parameters with a simple solution.

This issue is also discussed in D&E. When you have ordinary function calls,
you also have the names/values used in the call, to help you understand the
meaning of the parameters. Consider:

Window w=make_window("Title",0,0,100,100,some_flags);

with defaults anywhere in the parameter list, you could get:

Window w=make_window(,,,,,123);

It may be non-trivial to figure out what the number corresponds to, unless
you remember what the preceding parameters are, or look them up.

This was a concern mentioned in D&E, and also what Dave says here.

If you instead used (named parameters): make_window(flags_is(123)), or use
detection by type, as Dave described, it could be easier to see what is
going on.

Regards,

Terje