Boost logo

Boost :

From: Daniel James (daniel_at_[hidden])
Date: 2004-11-14 06:07:21

Doug Gregor wrote:
> - What is your evaluation of the design?

Very good. I feel that it would better to use a slightly awkward calling
syntax to avoid the forwarding functions, but that's not that big a deal.

I'm also worried about assignments getting confused with named
parameters. Consider the following:

     bool movable;
     create_window(movable = true);

Here the local variable movable is assigned to and the value true is
passed to create_window's first positional argument. This could lead to
subtle bugs. I'm not sure that the positional interface is worth it.

I would also like to see macros to generate member functions, that
support const and static member functions.

It would be nice to be able to easily tell if an argument is present or
not. Something along the lines of:

      if(p.find(movable)) {
          bool x = p[movable];

> - What is your evaluation of the implementation?

Very good.

> - What is your evaluation of the documentation?

The tutorial is good. As others have pointed out, it could do with a
full reference and more examples.

A useful example would be showing how by forwarding to a non-template
function, so that the implementation doesn't have to be in the header
class or can be a virtual member function. Something along the lines of:

     window* new_window_concrete(char const* name, bool border,
         bool opaque, bool movable);

     BOOST_NAMED_PARAMS_FUN(window*, new_window, 0, 4,
         new_window_concrete(p[name | 0], p[border | false],
             p[opaque | true], p[movable | true]);

This may seem obvious, but it took me a little while to realise it.

> - What is your evaluation of the potential usefulness of the library?

I think it could be useful when appropriate. I have some sympathy with
Thorsten's views about misuse, but I think there are cases when named
parameters are appropriate.

> - Did you try to use the library? With what compiler? Did you
> have any problems?

Yes, with gcc and intel on linux. I've reported a problem, and a fix has
been checked in (although, I haven't tried that).

> - How much effort did you put into your evaluation? A glance? A
> quick reading? In-depth study?

I've read the documentation, had a look through the code and tried
writing a few examples.

> - Are you knowledgeable about the problem domain?

I can program in C++ and have some experience with languages that
support named parameters.

I vote that the library should be accepted into boost. I have some small
worries but I think the quality of the library is high enough and boost
is the perfect place to find out how well named parameters can work for C++.


Boost list run by bdawes at, gregod at, cpdaniel at, john at