220 31931 <CAOfiQq=rWc3pUeEf3Jo-H-oGJQnyVvRwmqaOPYC7v2WJDMeHDg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Richard Smith <richard@metafoo.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: This variable should not be named: an identifier
 (not) to remember
Date: Sun, 2 Apr 2017 13:13:13 -0700
Lines: 208
Approved: news@gmane.org
Message-ID: <CAOfiQq=rWc3pUeEf3Jo-H-oGJQnyVvRwmqaOPYC7v2WJDMeHDg@mail.gmail.com>
References: <985b9b2a-c734-45eb-95f4-db4dc0d309a1@isocpp.org>
 <CAOfiQqnfaqA4YhpNphKg4oPPAMNOe7vPjqxqLvA-EnGjk-pVEA@mail.gmail.com>
 <1491170458.9U0G8TLsOk@tjmaciei-mobl1> <CAOfiQqmkjfEqEQpbxWnaLfibTpRTKJdF2UN8M60pL38Qg5s43g@mail.gmail.com>
 <10c2c556-b6bb-4714-83bc-7b0ac8fd4143@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a1143843c647b88054c34ad70
X-Trace: blaine.gmane.org 1491164015 15336 195.159.176.226 (2 Apr 2017 20:13:35 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 2 Apr 2017 20:13:35 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDVNBJG4YAIBB35WQXDQKGQEY3AT2QY@isocpp.org Sun Apr 02 22:13:30 2017
Return-path: <std-proposals+bncBDVNBJG4YAIBB35WQXDQKGQEY3AT2QY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f72.google.com ([209.85.215.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBB35WQXDQKGQEY3AT2QY@isocpp.org>)
	id 1culsQ-0003Wc-2m
	for gclcip-std-proposals@m.gmane.org; Sun, 02 Apr 2017 22:13:30 +0200
Original-Received: by mail-lf0-f72.google.com with SMTP id i8sf24332308lfe.14
        for <gclcip-std-proposals@m.gmane.org>; Sun, 02 Apr 2017 13:13:36 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=R8uA4huraQ7C4Z77yqhadHGwbERCf4RyA+MbDOV2/2k=;
        b=hvcfB/skF699heISTyH+LqBem+xhZUQmqJs6BtD4p74ekiKWg3QOq82jL8/zjG1Cpm
         NbDO2v5rVublKLGBWmfrJsnjeMqCIdLmWE5gbi0X0e8kIJl2f+2l0BsfUYeYw49f/4Zz
         +8mRi3jFSPJXr+bzhBYqd04uwExDTus8ZBXXnA8JTF8azR8mqpvEL5/uX6wT3D4Sq3nQ
         MlwTgofKAA6THTTdV3RHHwFTihWlTmzB7VtFfR3FEHfNBPCcaKRP7PWmC6Yl3J0dnW16
         KDV4pQDivkrYBks0bxu8PtrU1qUZzyS9Aw5KPz4L5c872FvzEVGOuTdG9dbWTfI5uhZh
         cp4g==
X-Gm-Message-State: AFeK/H2rpmYLWXIAah112nHG/d/gMRCe4E5C7eZ2NZMe0pDyitf2TZniKK7DW/iiFO4HUA==
X-Received: by 10.46.87.80 with SMTP id r16mr1420031ljd.12.1491164016362;
        Sun, 02 Apr 2017 13:13:36 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.15.205 with SMTP id 196ls546726wmp.1.gmail; Sun, 02 Apr
 2017 13:13:35 -0700 (PDT)
X-Received: by 10.223.155.147 with SMTP id d19mr11506046wrc.21.1491164015128;
        Sun, 02 Apr 2017 13:13:35 -0700 (PDT)
Original-Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com. [2a00:1450:400c:c0c::242])
        by mx.google.com with ESMTPS id p96si17058107wrb.39.2017.04.02.13.13.35
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 02 Apr 2017 13:13:35 -0700 (PDT)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 2a00:1450:400c:c0c::242 as permitted sender) client-ip=2a00:1450:400c:c0c::242;
Original-Received: by mail-wr0-x242.google.com with SMTP id k6so27149469wre.3
        for <std-proposals@isocpp.org>; Sun, 02 Apr 2017 13:13:35 -0700 (PDT)
X-Received: by 10.223.176.250 with SMTP id j55mr11852457wra.11.1491164014604;
 Sun, 02 Apr 2017 13:13:34 -0700 (PDT)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.80.148.82 with HTTP; Sun, 2 Apr 2017 13:13:13 -0700 (PDT)
In-Reply-To: <10c2c556-b6bb-4714-83bc-7b0ac8fd4143@isocpp.org>
X-Original-Sender: richard@metafoo.co.uk
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of metafoo@gmail.com
 designates 2a00:1450:400c:c0c::242 as permitted sender) smtp.mailfrom=metafoo@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:31931
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31931>

--001a1143843c647b88054c34ad70
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 2 April 2017 at 12:45, Nicol Bolas <jmckesson@gmail.com> wrote:

> On Sunday, April 2, 2017 at 3:28:54 PM UTC-4, Richard Smith wrote:
>>
>> On 2 April 2017 at 11:03, Thiago Macieira <thi...@macieira.org> wrote:
>>
>>> On s=C3=A1bado, 1 de abril de 2017 21:19:37 PDT Richard Smith wrote:
>>> > Have you considered that possibility? It would give a better name (_
>>> rather
>>> > than __) and avoid "breaking" existing code that uses __.
>>>
>>> _ is not reserved to the compiler and is VERY often #defined to gettext=
..
>>>
>>
>> Only as a function-like macro.
>>
>> Let's use __.
>>
>>
>> Let's use the thing that works best for C++, sure. I am not (yet)
>> convinced that's __.
>>
>
> Well, let's look at the options.
>
> You can't use nothing; that would create parsing ambiguities. So you have
> to put something there: either an identifier or something that is not an
> identifier.
>
> If it is not an identifier, then it must be a keyword (new or old) or som=
e
> form of punctuation. Adding a new keyword for something like this is rath=
er
> silly. And I don't know of an old keyword that would make for a good
> placeholder.
>
> You could use `[]` as I once suggested, piggybacking off of structured
> binding rules. But most other punctuation would be confusing or otherwise
> unexpected in a variable declaration.
>
> If it is an identifier, then it must be a *reserved* identifier, to
> minimize code breakage when we change its meaning.
>

As I pointed out, this is an incorrect conclusion. There is no necessity
for any code breakage here, and there is no need to pick a reserved
identifier: the core functionality of this proposal does not require that
the identifier be unusable within its scope, and if we don't add that
restriction, this is strictly an extension.

The shortest reserved identifier is `_`, which is currently reserved for
> use by the implementation, but only for names in the global namespace.
> Which means that right now, this is 100% legal:
>
> namespace foo
> {
>   constexpr int _ =3D 20;
> }
>
> So changing the meaning of that code is a non-starter.
>
> The second shortest reserved identifiers are of the form `_*`, where `*`
> is an uppercase letter or `_`. These are reserved by the implementation f=
or *any
> use*. And implementations are more easily changed than user code.
>
> So from my perspective, `__` is the most viable identifier.
>
> --
> 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
> email 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/10c2c556-b6bb-4714-
> 83bc-7b0ac8fd4143%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/10c2c556-b6=
bb-4714-83bc-7b0ac8fd4143%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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/CAOfiQq%3DrWc3pUeEf3Jo-H-oGJQnyVvRwmqaOPYC7v2WJD=
MeHDg%40mail.gmail.com.

--001a1143843c647b88054c34ad70
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On 2=
 April 2017 at 12:45, Nicol Bolas <span dir=3D"ltr">&lt;<a href=3D"mailto:j=
mckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>&gt;</span> wr=
ote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Sunday, April 2,=
 2017 at 3:28:54 PM UTC-4, Richard Smith wrote:<span class=3D""><blockquote=
 class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px =
#ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quot=
e">On 2 April 2017 at 11:03, Thiago Macieira <span dir=3D"ltr">&lt;<a rel=
=3D"nofollow">thi...@macieira.org</a>&gt;</span> wrote:<br><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><span>On s=C3=A1bado, 1 de abril de 2017 21:19:37 PDT Richar=
d Smith wrote:<br>
&gt; Have you considered that possibility? It would give a better name (_ r=
ather<br>
&gt; than __) and avoid &quot;breaking&quot; existing code that uses __.<br=
>
<br>
</span>_ is not reserved to the compiler and is VERY often #defined to gett=
ext.<br></blockquote><div><br></div><div>Only as a function-like macro.</di=
v><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex">
Let&#39;s use __.</blockquote><div><br></div><div>Let&#39;s use the thing t=
hat works best for C++, sure. I am not (yet) convinced that&#39;s __.</div>=
</div></div></div></blockquote></span><div><br>Well, let&#39;s look at the =
options.<br><br>You can&#39;t use nothing; that would create parsing ambigu=
ities. So you have to put something there: either an identifier or somethin=
g that is not an identifier.<br><br>If it is not an identifier, then it mus=
t be a keyword (new or old) or some form of punctuation. Adding a new keywo=
rd for something like this is rather silly. And I don&#39;t know of an old =
keyword that would make for a good placeholder.<br><br>You could use `[]` a=
s I once suggested, piggybacking off of structured binding rules. But most =
other punctuation would be confusing or otherwise unexpected in a variable =
declaration.<br><br>If it is an identifier, then it must be a <i>reserved</=
i> identifier, to minimize code breakage when we change its meaning.</div><=
/div></blockquote><div><br></div><div>As I pointed out, this is an incorrec=
t conclusion. There is no necessity for any code breakage here, and there i=
s no need to pick a reserved identifier: the core functionality of this pro=
posal does not require that the identifier be unusable within its scope, an=
d if we don&#39;t add that restriction, this is strictly an extension.</div=
><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>The sh=
ortest reserved identifier is `_`, which is currently reserved for use by t=
he implementation, but only for names in the global namespace. Which means =
that right now, this is 100% legal:<br><br><div style=3D"background-color:r=
gb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wid=
th:1px" class=3D"m_6865967731990214384prettyprint"><code class=3D"m_6865967=
731990214384prettyprint"><div class=3D"m_6865967731990214384subprettyprint"=
><span style=3D"color:#008" class=3D"m_6865967731990214384styled-by-prettif=
y">namespace</span><span style=3D"color:#000" class=3D"m_686596773199021438=
4styled-by-prettify"> foo<br></span><span style=3D"color:#660" class=3D"m_6=
865967731990214384styled-by-prettify">{</span><span style=3D"color:#000" cl=
ass=3D"m_6865967731990214384styled-by-prettify"><br>=C2=A0 </span><span sty=
le=3D"color:#008" class=3D"m_6865967731990214384styled-by-prettify">constex=
pr</span><span style=3D"color:#000" class=3D"m_6865967731990214384styled-by=
-prettify"> </span><span style=3D"color:#008" class=3D"m_686596773199021438=
4styled-by-prettify">int</span><span style=3D"color:#000" class=3D"m_686596=
7731990214384styled-by-prettify"> _ </span><span style=3D"color:#660" class=
=3D"m_6865967731990214384styled-by-prettify">=3D</span><span style=3D"color=
:#000" class=3D"m_6865967731990214384styled-by-prettify"> </span><span styl=
e=3D"color:#066" class=3D"m_6865967731990214384styled-by-prettify">20</span=
><span style=3D"color:#660" class=3D"m_6865967731990214384styled-by-prettif=
y">;</span><span style=3D"color:#000" class=3D"m_6865967731990214384styled-=
by-prettify"><br></span><span style=3D"color:#660" class=3D"m_6865967731990=
214384styled-by-prettify">}</span></div></code></div><br>So changing the me=
aning of that code is a non-starter.<br><br>The second shortest reserved id=
entifiers are of the form `_*`, where `*` is an uppercase letter or `_`. Th=
ese are reserved by the implementation for <i>any use</i>. And implementati=
ons are more easily changed than user code.<br><br>So from my perspective, =
`__` is the most viable identifier.<br></div></div><span class=3D"">

<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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/10c2c556-b6bb-4714-83bc-7b0ac8fd4143%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/10c2=
c556-b6bb-4714-<wbr>83bc-7b0ac8fd4143%40isocpp.org</a><wbr>.<br>
</blockquote></div><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/CAOfiQq%3DrWc3pUeEf3Jo-H-oGJQnyVvRwmq=
aOPYC7v2WJDMeHDg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOfiQq%3DrWc3p=
UeEf3Jo-H-oGJQnyVvRwmqaOPYC7v2WJDMeHDg%40mail.gmail.com</a>.<br />

--001a1143843c647b88054c34ad70--

.
