Boost logo

Boost :

From: Thomas Wenisch (twenisch_at_[hidden])
Date: 2002-09-01 15:47:02


On Sun, 1 Sep 2002, Douglas Paul Gregor wrote:

> > Now I have seen two different opinions:
> > 1) People who want stuff like "std::string demangle_type(std::type_info const&)"
> > and
> > 2) People who said that providing more than one interface (wrappers)
> > as part of boost is interface bloat.
> >
> > I tend to agree with 2). So what shall we do?
> > How about I just start with only the main interface? :)
>
> With alternate interfaces, we can only guess at what is useful and what is
> bloat. My feeling is that there are two kinds of users for a demangle
> library:
> 1) Simple uses like 'demangle(typeid(T))' for simple debugging output.
> No need to customize allocators or deal with multiple kinds of input for
> these users.
> 2) Advanced users that have very strict time/space requirements. These
> users need to customize allocation, input type, output style, etc. for
> maximum performance/safety/etc.
>
> So, the general interface covers #2, and I suggest this simple interface
> to cover #1:
>
> std::string demangle(const std::string& symbol);
> std::string demangle(const std::type_info& type);
>
> Doug

I strongly agree with Doug here. While Carlo is right, all you really
need is the general interface, the user base that Doug is helping out with
the simple interface is also the user base that might not have the
expertise to see immediately how to write the wrapper functions around the
general interface. If we chose to only have the general interface, the
result would be that the simple wrappers would probably end up appearing
as examples in the documentation. With the simple interface, most users
won't even need documentation - it is fairly obvious what

  std::string demangle(const std::type_info & type);

does just by looking at the signature. I think the usability benefit of
these two additional functions outweighs the cost of interface bloat.
The real cost of interface bloat comes when a library provides so many
ways of doing things that the user is lost in a see of options with no
criteria to choose between them. However, if we have a clear distinction
between a basic interface, which provides exactly one idiom for each of
covering the most common use cases, and an advanced interface which is
fully general, I don't think that is bloat.

Regards,
-Tom Wenisch
Computer Architecture Lab
Carnegie Mellon University


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk