Boost logo

Boost :

Subject: Re: [boost] [Hana] Informal review request
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2015-03-05 15:56:27


Matt Calabrese <rivorus <at> gmail.com> writes:

>
> On Thu, Mar 5, 2015 at 6:41 AM, Louis Dionne <ldionne.2 <at> gmail.com> wrote:
>
> [...]
>
> I'm sure these problems can be resolved, but I definitely think it is
> important to fully address them before formal review. The subtlety of the
> problems and the ease of misuse makes things really scary to me and I would
> be worried if a lot of library code ended up getting written on top of this
> without solutions in place.
>
> If any of this is already solved by way of tricks that I'm not aware of (I
> haven't looked through the source yet), then just make sure people know
> that they, too, must utilitze such tricks when making their own hana-style
> metafunctions.

Yes, this is already taken care of and no unfortunate instantiations
will take place. The downside is that `decltype(tuple_t<T...>)` is an
unspecified dependent type that only _inherits_ `_tuple<T...>`.
It is still possible to use pattern matching in overloads as follows:

    template <typename ...T>
    void f(hana::_tuple_t<T...>) {
        // ...
    }

You can see how this is implemented here: http://goo.gl/iISNpb
And the unit test here: http://goo.gl/sBqMZo

I'm playing with fire, I know :-). I read the process of ADL
very carefully when I thought about this, but it is also
possible that I'm exploiting a Clang bug. What do you think?

Louis

P.S.: Thanks for letting me know of this issue at C++Now.


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