C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Proposal to allow multiple template parameters packs of different types

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Mon, 14 Nov 2022 11:17:57 -0500
On Mon, Nov 14, 2022 at 8:48 AM Anoop Rana via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Attached is the proposal [...]
>

Section 1 (1.1, 1.2) points out the problem with
    template<class... Ts, class... Us> void f();
    f<int, int>();
Is this Ts=<>, Us=<int,int>? or Ts=<int>, Us=<int>? or Ts=<int,int>, Us=<>?
Today it is ambiguous (i.e. ill-formed). Anoop's paper section 1.2 mentions
the possibility of making it greedy thus unambiguously Ts=<int,int>, Us=<>,
but as far as I could tell, Anoop rejects that outcome.

But then consider this code:
    template<class... Ts, bool... Bs, class... Us> void f();
    f<int, int>();
Is this Ts=<>, Bs=<>, Us=<int,int>? or Ts=<int>, Bs=<>, Us=<int>? or
Ts=<int,int>, Bs=<>, Us=<>?
Today it is ambiguous (i.e. ill-formed). Anoop's paper *seems* to be
suggesting that this should become greedy thus unambiguously Ts=<int,int>,
Bs=<>, Us=<>.
But why should this case be any greedier than the previous case? They
should be handled *consistently*, one way or the other. I think the
current Standard *does* handle them consistently; we should break that
consistency only with a really good reason.

Speaking of "good reason": the paper offers no motivation for this change
at all. It *asserts* that the status quo "doesn't make sense," but doesn't
present any problems caused by the status quo, either in terms of "I can't
write this useful code" or "I can't teach this effectively" or whatever.
Without motivation, a change of this magnitude should have a strong
presumption of being-rejected.
Section 3 is currently titled "Motivation and Scope," but it doesn't talk
about motivation and doesn't really have to do with "scope" either. I think
this was a cut-and-paste/template error.

–Arthur

Received on 2022-11-14 16:18:10