Boost logo

Boost :

Subject: Re: [boost] New library? CallableTraits
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2016-05-15 09:13:55

Barrett Adair <barrettellisadair <at>> writes:

> I posted about this a month ago, but I did not receive much response. Since
> then, I added an extended example use case, and I added a documentation
> section [1] that compares CallableTraits and Boost.FunctionTypes.
> I received some positive feedback this week in Aspen, and r/cpp also seemed
> to respond well [2], so I thought I'd give this another shot.
> Here are my questions for you:
> 1. Is there any interest in reviewing a future version of this for
> inclusion in Boost?

I think so. I've also heard a couple of people say that they needed similar
functionality this week in Aspen, so I imagine this would be a useful
addition to Boost. In the long term, I think we need something similar
(perhaps a subset of CallableTraits) in the standard.

> 2. If so, does this belong in its own library, or should it be incorporated
> into Boost.TypeTraits or something similar?

No strong opinion here, though it might be a bit large for an addition to
Boost.TypeTraits? In all cases, if there's a review of the library, you can
count on me to submit one.

> 3. What you like to see added, removed, renamed, or redesigned?

Here are a few comments on the documentation and the library itself:

- IMO, the overview should include explanations in running text rather than
  just comments in the code. Or if you want to keep code only, which might be
  a good idea, I would make it a bit shorter. Do not try to show all the
  features and details of the library; this is just an overview.

- The Java-style interface example is _huge_, and IMO it doesn't fit into an
  example at the beginning of the documentation. It might be better to include
  it as an appendix.

- The library documents many concepts, but it seems to me that they are not
  really concepts as we usually mean in C++. To me, most of them are just
  vocabulary terms (that could e.g. appear in a glossary). When I introduce
  concepts in a library, I usually design my concepts as some kind of
  hierarchy with semantic properties that allow me to describe a few key
  types of objects. Instead, I see some "concepts" in CallableTraits as just
  glossary terms without semantics. For example, instead of the "FunctionPtr"
  concept, you could have a "Function pointer" entry in a glossary.

- Suggestion: use `replace_at` instead of `overwrite_at`?

- A few metafunctions have the `_at` suffix; is this necessary?

- Instead of `can_invoke`, something like `is_invokable` might be better?
  Querying traits often start with `is_`.

> I'd say CallableTraits is about 85% finished. Here's what's left:
> * Add INVOKE semantics to a couple of things for consistency (arity, etc)
> * Remove unused/undocumented code
> * Account for transaction_safe and C++17 noexcept
> * Finish/test the calling convention features
> * Finish/update the reference documentation

Finishing the reference documentation is, IMO, the #1 priority if others
express interest towards the library and you want to make it part of Boost.
I don't think a formal review can take place before the documentation is
done, but you might want to wait to see if there's interest before investing
a lot of time in the documentation.


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