220 34739 <3a958923-c648-4d7e-a596-4f1fee6789c1@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: florian.csdt@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Concepts are Adjectives, not Nouns
Date: Tue, 10 Oct 2017 08:46:25 -0700 (PDT)
Lines: 314
Approved: news@gmane.org
Message-ID: <3a958923-c648-4d7e-a596-4f1fee6789c1@isocpp.org>
References: <7e0b8951-a46a-470d-bb7c-1651e6c4d707@isocpp.org>
 <c5c43c70-2ffe-4654-9756-69facbf4cb0a@isocpp.org>
 <22229cfe-0d43-5c01-cef4-b6502de658c1@honermann.net>
 <c2fdfc33-6c25-4c7d-8b27-216c87927403@isocpp.org>
 <43f95138-da2b-4f46-a6c7-2b4c05a2d277@isocpp.org>
 <66b299de-203d-b770-a6d8-7bcbb2a118fb@honermann.net>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3515_1782492104.1507650385467"
X-Trace: blaine.gmane.org 1507650403 2981 195.159.176.226 (10 Oct 2017 15:46:43 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 10 Oct 2017 15:46:43 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC26HM4V3MIRBUWW6PHAKGQEHSDXINI@isocpp.org Tue Oct 10 17:46:38 2017
Return-path: <std-proposals+bncBC26HM4V3MIRBUWW6PHAKGQEHSDXINI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f71.google.com ([209.85.213.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC26HM4V3MIRBUWW6PHAKGQEHSDXINI@isocpp.org>)
	id 1e1wjr-0007Yd-05
	for gclcip-std-proposals@m.gmane.org; Tue, 10 Oct 2017 17:46:35 +0200
Original-Received: by mail-vk0-f71.google.com with SMTP id d12sf17677466vkf.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 10 Oct 2017 08:46:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=8HPSEG7ZvjL70hn9oYPp9o9VYmGW7Fq76WjZTc9FPYc=;
        b=YclQOsQgmBhPbz9HTFux3aaUWYEpzZ9/0yGG0p5J5TLt+1O9QeNyiSzlYywyrTjb2a
         ROajakmTQT1IlPMRhagNmKul4lpdZqjsA39CyZH09KAMJuEdThNMuqWxd50yxAo792R4
         39gNek2LCZlFVO0iq3D0RHX4wPnY0yDRp3K0nKVzDCFJDi4v4E7Md1T6dq0e9WOaMDZK
         lyp7tX3qs2NgsbZveypKJr6jzwPgOa3qNvCXosSIeUqLR0obSBX1U+Ym6XFkZgEkDJpl
         mCDZTsl/85evNLOuZU3W88qUsyy0xxvnoKmBME5635fYpMeNC7Eah73dN+u4lCKhsPq3
         5u6A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=8HPSEG7ZvjL70hn9oYPp9o9VYmGW7Fq76WjZTc9FPYc=;
        b=FbBDRsj3zxaCjAzc95Mcop0CZjwtW88jXFuzX5ddypJD1b3OKT0ttQuNXCXnjcnG4C
         4/IZejOY5KucW/btJrueyQx74dp/GEotgjIp0yKs3VS0FIa+wOb9RcbOrZatwsnAWUwY
         ERubP1b+Lr/odpSHVqP2gRmVZCmFwoXtklndtF19SU26+IHbJu/b8Wj+oisjTGsVAjEm
         OXstt+TaFx1beJmBGs8DlUWwRFowAaWU1wUGA1djptNnq6fvcrx5oFJcEZCiSJqxRQ4x
         xNy61uV6fwM0ce0Nwwt5pJDqGHTOrzJjidmY2pe9ioxccqJa+qJ+JYVy+LY+20ZB6Sbb
         H/xA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=8HPSEG7ZvjL70hn9oYPp9o9VYmGW7Fq76WjZTc9FPYc=;
        b=ERnI9tKyQRnQwg26AkqG7etP2wDYSBj/hlS+27/EI4evf8BxAEqrWWQ472CuemrqjO
         6cxd5OL1003uRcbhHGo4upCmji9CM1qAh0IsRmHYPZImmk/T4Q5POL72s9wst9OwhxjV
         5IzwRNmorIrGEqGd6kEdf2kYC/M4g5AyblvrIikXdo8d3JAyHUVYo4h6gS+HYTzi2peH
         1dm8HnRqwLCR+qYoAqwmwpFOw0fzRIN2ZP4mA+cyyYMx7IU5XI73Ic6JJQziXsQztwAp
         uEaQnnkT9XMqSmyeBuCBLdz7VdGILQpvCb8rz1V41wIbsi1KU6JeXBFml0ZGE3OtgkV7
         3stQ==
X-Gm-Message-State: AMCzsaVHN5VLgV1wxydkp2RLR1T9k7mHR0in6BHD7Tf1M91m2F9+K3Fd
	v/U7U7hM8LZiQEkRHtSzE9fMwA==
X-Google-Smtp-Source: AOwi7QDzw61D7WMn1+mzsgvTD7RSroVxEMCRTxHhNjrzCEInnbqzkC7Mr98qvix2jk6ogxhikfNsSw==
X-Received: by 10.31.96.138 with SMTP id u132mr2894878vkb.115.1507650387517;
        Tue, 10 Oct 2017 08:46:27 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.153.129 with SMTP id b123ls2213657vke.20.gmail; Tue, 10 Oct
 2017 08:46:26 -0700 (PDT)
X-Received: by 10.31.178.146 with SMTP id b140mr687577vkf.24.1507650386127;
        Tue, 10 Oct 2017 08:46:26 -0700 (PDT)
In-Reply-To: <66b299de-203d-b770-a6d8-7bcbb2a118fb@honermann.net>
X-Original-Sender: florian.csdt@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:34739
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34739>

------=_Part_3515_1782492104.1507650385467
Content-Type: multipart/alternative; 
	boundary="----=_Part_3516_1750946424.1507650385467"

------=_Part_3516_1750946424.1507650385467
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Le mardi 10 octobre 2017 17:19:26 UTC+2, Tom Honermann a =C3=A9crit :
>
> On 10/10/2017 05:51 AM, floria...@gmail.com <javascript:> wrote:
>
> Now the tricky part, the definition of a template (function or class: sam=
e=20
> problem):
> template <Integer T> struct bar;
> In this case, it is ambiguous (probably not within the current proposed=
=20
> grammar, but semantically).
> T could be a type satisfying the concept Integer, or T could a non-type=
=20
> parameter whose type satisfies Integer.
>
>
> Not quite.
>
> If Integer is a concept, T is a type, non-type, or template parameter;=20
> which one depends on the kind of Integer's first template parameter (the=
=20
> prototype parameter).
>
> If Integer is a type, then T is a non-type parameter.
>

With the current proposal, I agree with you, there is no compiler ambiguity=
..
My point is not about how it is currently but how it should be.

Let me rephrase my example:
template <class T>
concept Integer =3D /* T is an Integer type */;


int i =3D 0;     // i is a value of type int
Integer j =3D 0; // j is also a value whose type satisfies the concept Inte=
ger

// In this case, both regular type and concepts behave the same


// The following template (without concept) has non-type template parameter=
:
template <int I> struct foo;

// The following template (with concept) **currently** has type template=20
parameter:
template <Integer I> struct bar;

// Now regular types and concepts behave differently with the current draft

// How you would write a template with a non-type parameter whose type is=
=20
constrained?
// just mimic the syntax for non-type parameters:
// template <Integer I> struct bar; // No, this is the same as before

template <auto I> requires Integer<decltype(I)> struct bar; // a bit=20
clumsy, not even sure it works with classes

// Jakob's proposal:
template <Integer auto I> struct bar;

I hope now my little example shows you clearly the problem with the current=
=20
grammar. And I can assure you that users will want both types and non-type=
=20
template parameters for concepts on types.
=20

>
> My point of view about the proposal: I like the idea to put several=20
> constraint on the same type without requiring any "require" clause. I=20
> understand and approve, the need for disambiguation for the template=20
> parameters.
> However, I would prefer an optional disambiguator. When it is not present=
,=20
> disambiguate arbitrarily (I would prefer to non-type parameters as it is=
=20
> more consistent, but it would more useful to disambiguate to types in thi=
s=20
> case).
> I also think the ambiguity is present only in template parameters for now=
..
>
>
> The use of disambiguation has a bit of a rocky history in C++.  For=20
> example, the most-vexing parse, and 'typename' and 'template' keyword=20
> disambiguation.
>

Agreed, I would prefer never have to type 'template' and 'typename'=20
disambiguator.
But here, it is a bit different. It is not about telling the compiler=20
something that it should know, but telling the compiler what choice we made=
=20
among two perfectly valid choices.

And that's also because we don't to repeat a lot of meaningless=20
disambiguator that we should have a default disambiguation policy (either=
=20
the most common or the most consistent).
=20

>
> Tom.=20
>

Hope I disambiguated the situation ;)

Florian=20

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/3a958923-c648-4d7e-a596-4f1fee6789c1%40isocpp.or=
g.

------=_Part_3516_1750946424.1507650385467
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Le mardi 10 octobre 2017 17:19:26 UTC+2, Tom Honer=
mann a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>On 10/10/2017 05:51 AM,
      <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"2y=
gWHYk1BAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#3=
9;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;"=
>floria...@gmail.com</a> wrote:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">Now the tricky part, the definition of a template
        (function or class: same problem):<br>
        <div style=3D"background-color:rgb(250,250,250);border-color:rgb(18=
7,187,187);border-style:solid;border-width:1px"><code>
            <div><span style=3D"color:#008">template</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Integer</span><span style=3D"color:#000"> T</span><span style=3D"c=
olor:#660">&gt;</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#008">struct</span><span style=3D"color:#000"> bar</span><span style=3D"=
color:#660">;</span><span style=3D"color:#000"><br>
              </span></div>
          </code></div>
        In this case, it is ambiguous (probably not within the current
        proposed grammar, but semantically).<br>
        T could be a type satisfying the concept Integer, or T could a
        non-type parameter whose type satisfies Integer.<br>
      </div>
    </blockquote>
    <br>
    Not quite.<br>
    <br>
    If Integer is a concept, T is a type, non-type, or template
    parameter; which one depends on the kind of Integer&#39;s first templat=
e
    parameter (the prototype parameter).<br>
    <br>
    If Integer is a type, then T is a non-type parameter.<br></div></blockq=
uote><div><br>With the current proposal, I agree with you, there is no comp=
iler ambiguity.<br>My point is not about how it is currently but how it sho=
uld be.<br><br>Let me rephrase my example:<br><div style=3D"background-colo=
r: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: soli=
d; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><co=
de class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color=
: #008;" class=3D"styled-by-prettify">template</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">conc=
ept</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #606;" class=3D"styled-by-prettify">Integer</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;=
" class=3D"styled-by-prettify">/* T is an Integer type */</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br><br></span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> i </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-=
prettify">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =
=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// =
i is a value of type int</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">Integer</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> j </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">// j is also a value whose type satisfies t=
he concept Integer</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><br>// In this case, both regular type and concepts beha=
ve the same<br><br><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><code class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">// The following template (without concept) has non-type template pa=
rameter:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #008;" class=3D"styled-by-prettify">template=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> I</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> foo</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br>// The following template (with concept) **currently** has type te=
mplate parameter:<br>template &lt;Integer I&gt; struct bar;<br><br>// Now r=
egular types and concepts behave differently with the current draft<br><br>=
// How you would write a template with a non-type parameter whose type is c=
onstrained?<br>// </span></code></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><code class=3D"prettyprint"><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><code class=3D"prettyprint"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><code class=3D"prettyprint">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><code class=3D"pr=
ettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify"><code =
class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">just mimic the syntax for non-type parameters:<br></span></code></span=
></code></span></code></span></code>// </span></code></span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><code class=3D"prettyprint"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><code class=3D"pretty=
print"><span style=3D"color: #000;" class=3D"styled-by-prettify"><code clas=
s=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>template &lt;Integer I&gt; struct bar; // No, this is the same as before<b=
r><br>template &lt;auto I&gt; requires Integer&lt;decltype(I)&gt; struct ba=
r; // a bit clumsy, not even sure it works with classes<br><br>// Jakob&#39=
;s proposal:<br>template &lt;Integer auto I&gt; struct bar;<br></span></cod=
e></span></code></span></code></span></div></code></div><br>I hope now my l=
ittle example shows you clearly the problem with the current grammar. And I=
 can assure you that users will want both types and non-type template param=
eters for concepts on types.<br>=C2=A0</div><blockquote class=3D"gmail_quot=
e" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddin=
g-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <br>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">My point of view about the proposal: I like the
        idea to put several constraint on the same type without
        requiring any &quot;require&quot; clause. I understand and approve,=
 the
        need for disambiguation for the template parameters.<br>
        However, I would prefer an optional disambiguator. When it is
        not present, disambiguate arbitrarily (I would prefer to
        non-type parameters as it is more consistent, but it would more
        useful to disambiguate to types in this case).<br>
        I also think the ambiguity is present only in template
        parameters for now.<br>
      </div>
    </blockquote>
    <br>
    The use of disambiguation has a bit of a rocky history in C++.=C2=A0 Fo=
r
    example, the most-vexing parse, and &#39;typename&#39; and &#39;templat=
e&#39;
    keyword disambiguation.<br></div></blockquote><div><br>Agreed, I would =
prefer never have to type &#39;template&#39; and &#39;typename&#39; disambi=
guator.<br>But here, it is a bit different. It is not about telling the com=
piler something that it should know, but telling the compiler what choice w=
e made among two perfectly valid choices.<br><br>And that&#39;s also becaus=
e we don&#39;t to repeat a lot of meaningless disambiguator that we should =
have a default disambiguation policy (either the most common or the most co=
nsistent).<br>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div=
 bgcolor=3D"#FFFFFF" text=3D"#000000">
    <br>
    Tom.
  </div></blockquote><div><br>Hope I disambiguated the situation ;)<br><br>=
Florian <br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3a958923-c648-4d7e-a596-4f1fee6789c1%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3a958923-c648-4d7e-a596-4f1fee6789c1=
%40isocpp.org</a>.<br />

------=_Part_3516_1750946424.1507650385467--

------=_Part_3515_1782492104.1507650385467--

.
