220 16844 <54FB26B4.4050809@wanadoo.fr> article
Path: news.gmane.org!not-for-mail
From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: [c++std-core-27216] Re: An implementation of
 enhanced auto deduction and abbreviated template syntax using Clang
Date: Sat, 07 Mar 2015 17:26:28 +0100
Lines: 234
Approved: news@gmane.org
Message-ID: <54FB26B4.4050809@wanadoo.fr>
References: <CABsSThrwV0UCbrmoxoeQUskOjvF2+RX5ctpSq3dPMPxm=t6mww@mail.gmail.com>	<e0666226-5ebe-462b-9803-b70bd11b9491@isocpp.org>	<BLUPR03MB455C81E71E81F839F9326C9B81C0@BLUPR03MB455.namprd03.prod.outlook.com>	<CAGL0aWfGy3JmORCtovX53ogZpgtBdtFb0zgNg7ZYDNixQ-Nx_w@mail.gmail.com>	<CAFVAEf1+-_Ydmu9hjrJB29g+SsPifxHaDjgNGot3gVwQNoj-=A@mail.gmail.com>	<54F91983.2020808@stroustrup.com>	<54F930C8.30609@coverity.com> <CAOHCbitiPm7SKQwXSBWrV2KOhNsAPcmGW7JZ1B13VO57Fip2ig@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------040008010001080806040309"
X-Trace: ger.gmane.org 1425745601 24980 80.91.229.3 (7 Mar 2015 16:26:41 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 7 Mar 2015 16:26:41 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDH67CONY4PBBNGN5STQKGQEBASAE5Y@isocpp.org Sat Mar 07 17:26:33 2015
Return-path: <std-proposals+bncBDH67CONY4PBBNGN5STQKGQEBASAE5Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f198.google.com ([209.85.212.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDH67CONY4PBBNGN5STQKGQEBASAE5Y@isocpp.org>)
	id 1YUHYd-0005T3-1b
	for gclcip-std-proposals@m.gmane.org; Sat, 07 Mar 2015 17:26:31 +0100
Original-Received: by wivr20 with SMTP id r20sf6392117wiv.0
        for <gclcip-std-proposals@m.gmane.org>; Sat, 07 Mar 2015 08:26:30 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=fNy+cYCTcCBxc/IED5sWhMgv/PmmNlopqUYXQfxgXX0=;
        b=IodJ6vWeFGY1PkTpCs+dK+WlITtjbw514RGuk97OuBCDDGJN6dyEFSrnhjTB7+pKQ6
         ZZSapv5S7n9W9O1oCUEPmIh69VPjPPW0FzGPQ6uNH/5wLG0Zoth1CWWErqtahV0vPOz8
         lhBFl2mhtRk5hwFfIuEgeobEwc5+wwJihOg7kUgZA0BHzck9lKEhEcV9iMIG7oiNr2zW
         HPHEvWRyDiMSs7K+kj3vevWHFG2ULiTvsKKPL4Yv7D55LGAUsjX6INVAdFHEWJQqAN7t
         9Jnv9LF1TsCZjM1E3Z6RnqVL1jjNepbi733nCNGS2NJaV4wzgiDm9qCmWEwjpeFE7ZDD
         qhGw==
X-Gm-Message-State: ALoCoQmAyLNrOsNA7Nd1yL+G9tZ71uTeNT/ZhuFYceXQDijxYuj2G0flko6ELtsOfufZi9uEzH0D
X-Received: by 10.194.161.194 with SMTP id xu2mr3009423wjb.1.1425745590506;
        Sat, 07 Mar 2015 08:26:30 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.14.9 with SMTP id l9ls281398wic.11.canary; Sat, 07 Mar
 2015 08:26:28 -0800 (PST)
X-Received: by 10.180.208.74 with SMTP id mc10mr87328114wic.38.1425745588271;
        Sat, 07 Mar 2015 08:26:28 -0800 (PST)
Original-Received: from smtp.smtpout.orange.fr (smtp05.smtpout.orange.fr. [80.12.242.127])
        by mx.google.com with ESMTP id ck8si25850570wjb.30.2015.03.07.08.26.28
        for <std-proposals@isocpp.org>;
        Sat, 07 Mar 2015 08:26:28 -0800 (PST)
Received-SPF: none (google.com: vicente.botet@wanadoo.fr does not designate permitted sender hosts) client-ip=80.12.242.127;
Original-Received: from iMac-de-Vicente-Botet-Escriba.local ([2.11.66.123])
	by mwinf5d09 with ME
	id 0gSS1q00S2fZjpN03gSTLi; Sat, 07 Mar 2015 17:26:28 +0100
X-ME-Helo: iMac-de-Vicente-Botet-Escriba.local
X-ME-Auth: dmljZW50ZS5ib3RldEB3YW5hZG9vLmZy
X-ME-Date: Sat, 07 Mar 2015 17:26:28 +0100
X-ME-IP: 2.11.66.123
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
In-Reply-To: <CAOHCbitiPm7SKQwXSBWrV2KOhNsAPcmGW7JZ1B13VO57Fip2ig@mail.gmail.com>
X-Original-Sender: vicente.botet@wanadoo.fr
X-Original-Authentication-Results: mx.google.com;       spf=none (google.com:
 vicente.botet@wanadoo.fr does not designate permitted sender hosts) smtp.mail=vicente.botet@wanadoo.fr
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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:16844
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/16844>

This is a multi-part message in MIME format.
--------------040008010001080806040309
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 06/03/15 08:07, Tony V E a =C3=A9crit :
>
>
> On Thu, Mar 5, 2015 at 11:44 PM, Tom Honermann=20
> <thonermann@coverity.com <mailto:thonermann@coverity.com>> wrote:
>
>     We have this for lambdas:
>       auto l =3D [](auto x) { return x; }
>     If we could do (something like) these for generic functions, I
>     would be thrilled:
>       auto <>f(auto x) { return x; }
>       auto <>f(Iterator i) { return i; }
>
>
> The terse syntax with just 'auto' doesn't bother me (I think I will=20
> learn to scan for 'auto' params), but if we do choose to have=20
> distinctive syntax to note that it is a template, then I'll make a=20
> crazy suggestion: use the word 'template'
>
>     template void f(auto x) { ... }
>
> Although 'auto' doesn't bother me, as others have mentioned, Concepts=20
> give no hints:
>
>     void f(Number x) { ... }
>
> So either you know your concepts, or you IDE does (and gives them a=20
> different color or something) or maybe that is a reason to use 'template'=
:
>
>     template void f(Number x) { ... }
>
> (and thus use 'template' for the 'auto' case as well)
>
Could I suggest the use of something like '<>' to declare a type and the=20
required concept on the type parameter

     void f(Number<>N x) { ... }

Number<>N x

stands for

a parameter x having type N satisfying Number.

The Concept or the type can be omitted

     void f(<>N x) { ... }

a parameter x having type N without any constraint.

     void f(Number<> x) { ... }

a parameter x having an unknown type satisfying the Number concept.

This

     void f(<> x) { ... }

a parameter x having an unknown type without any constraint.

I we consider that auto mean no constraint, the more verbose syntax=20
could have a sens also

     void f(auto<> x) { ... }

I we consider that auto mean any type, the more verbose syntax could=20
have a sens also

     void f(<>auto x) { ... }

In any case we have the token <> that recall that we are defining a=20
template.

Vicente





--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--------------040008010001080806040309
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body text=3D"#000000" bgcolor=3D"#FFFFFF">
    <div class=3D"moz-cite-prefix">Le 06/03/15 08:07, Tony V E a =C3=A9crit=
=C2=A0:<br>
    </div>
    <blockquote
cite=3D"mid:CAOHCbitiPm7SKQwXSBWrV2KOhNsAPcmGW7JZ1B13VO57Fip2ig@mail.gmail.=
com"
      type=3D"cite">
      <div dir=3D"ltr"><br>
        <div class=3D"gmail_extra"><br>
          <div class=3D"gmail_quote">On Thu, Mar 5, 2015 at 11:44 PM, Tom
            Honermann <span dir=3D"ltr">&lt;<a moz-do-not-send=3D"true"
                href=3D"mailto:thonermann@coverity.com" target=3D"_blank">t=
honermann@coverity.com</a>&gt;</span>
            wrote:<br>
            <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">We have
              this for lambdas:<br>
              =C2=A0 auto l =3D [](auto x) { return x; }<br>
              If we could do (something like) these for generic
              functions, I would be thrilled:<br>
              =C2=A0 auto &lt;&gt;f(auto x) { return x; }<br>
              =C2=A0 auto &lt;&gt;f(Iterator i) { return i; }<span
                class=3D"HOEnZb"><font color=3D"#888888"><br>
                </font></span></blockquote>
            <div><br>
            </div>
            <div>The terse syntax with just 'auto' doesn't bother me (I
              think I will learn to scan for 'auto' params), but if we
              do choose to have distinctive syntax to note that it is a
              template, then I'll make a crazy suggestion: use the word
              'template'<br>
              <br>
            </div>
            <div>=C2=A0=C2=A0=C2=A0 template void f(auto x) { ... } <br>
            </div>
          </div>
          <br>
        </div>
        <div class=3D"gmail_extra">Although 'auto' doesn't bother me, as
          others have mentioned, Concepts give no hints:<br>
          <br>
        </div>
        <div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 void f(Number x) { ..=
.. }<br>
          <br>
        </div>
        <div class=3D"gmail_extra">So either you know your concepts, or
          you IDE does (and gives them a different color or something)
          or maybe that is a reason to use 'template':<br>
          <br>
        </div>
        <div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 template void f(Numbe=
r x) { ... }<br>
          <br>
        </div>
        <div class=3D"gmail_extra">(and thus use 'template' for the 'auto'
          case as well)<br>
        </div>
      </div>
      <br>
    </blockquote>
    Could I suggest the use of something like '&lt;&gt;' to declare a
    type and the required concept on the type parameter<br>
    <br>
    =C2=A0=C2=A0=C2=A0 void f(Number&lt;&gt;N x) { ... }<br>
    <br>
    Number&lt;&gt;N x <br>
    <br>
    stands for<br>
    <br>
    a parameter x having type N satisfying Number.<br>
    <br>
    The Concept or the type can be omitted<br>
    <br>
    =C2=A0=C2=A0=C2=A0 void f(&lt;&gt;N x) { ... }<br>
    <br>
    a parameter x having type N without any constraint.<br>
    <br>
    =C2=A0=C2=A0=C2=A0 void f(Number&lt;&gt; x) { ... }<br>
    <br>
    a parameter x having an unknown type satisfying the Number concept.<br>
    <br>
    This <br>
    <br>
    =C2=A0=C2=A0=C2=A0 void f(&lt;&gt; x) { ... }<br>
    <br>
    a parameter x having an unknown type without any constraint.<br>
    <br>
    I we consider that auto mean no constraint, the more verbose syntax
    could have a sens also<br>
    <br>
    =C2=A0=C2=A0=C2=A0 void f(auto&lt;&gt; x) { ... }<br>
    <br>
    I we consider that auto mean any type, the more verbose syntax could
    have a sens also<br>
    <br>
    =C2=A0=C2=A0=C2=A0 void f(&lt;&gt;auto x) { ... }<br>
    <br>
    In any case we have the token &lt;&gt; that recall that we are
    defining a template.<br>
    <br>
    Vicente<br>
    <br>
    <br>
    <br>
    <br>
    <br>
  </body>
</html>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--------------040008010001080806040309--

.
