C++ Logo

SG7

Advanced search

Subject: Re: P2320: "The Syntax of Static Reflection" feedback request
From: Roland Bock (rbock_at_[hidden])
Date: 2021-02-17 00:26:43


On 15.02.21 22:25, Hana Dusíková via SG7 wrote:
> Hi,
>
> Andrew, Wyatt, and Daveed kindly finished the paper which was mentioned
> during last SG7 session and because the next SG7 meeting is next week *I
> would like all of you to read the paper and send feedback to SG7 mailing
> list*, so we have as much of information as possible.
>
> The paper is here: https://isocpp.org/files/papers/P2320R0.pdf
> <https://isocpp.org/files/papers/P2320R0.pdf> and it will be part of the
> next mailing.
>
> Hana
>

Hi all,

The syntax looks looks good to me in general. But I am easy to please,
as long as I get the functionality :-)

The real concern I have is that examples are (probably by nature) rather
wooden. In the last couple of weeks, I tried to implement std::tuple
without inheritance, as a simple struct with data members, i.e.

template<typename... Ts>
struct tuple
{
    // ... some operators

    // And then data members that are generated as something like
    // This part might require fragments as proposed in P2237R0
    T0 m0;
    T1 m1;
    // ...
};

I know the current syntax proposal is incomplete, e.g. leaving out
identifier splices, but I would like to urge/challenge you to try
writing such a tuple as a litmus test.

In particular, I would like to draw your attention to

a) the following constructors

    constexpr tuple(const Ts&... args);

    template<typename... Us>
    constexpr tuple(Us&&... args);

    template< class... Us>
    constexpr tuple(const tuple<Us...>& other);

    template <class... Us>
    constexpr tuple(tuple<Us...>&& other);

b) tuple_cat

    template< class... Tuples >
    constexpr std::tuple<CTypes...> tuple_cat(Tuples&&... args);

Both tasks look deceivingly simple. And they /should/ be simple with
reflection in place, IMHO. Give it a try. How would that look like?

If we cannot write std::tuple nicely(!), I would claim we are doing it
wrong.

Just my 2ct.

Thanks,

Roland

PS: As of today, I have an ugly version of tuple_cat but cannot seem to
figure out how to write those constructors.
PPS: Most other stuff is actually quite elegant.


SG7 list run by sg7-owner@lists.isocpp.org

Older Archives on Google Groups