220 31903 <fb4d95ca-355d-4248-8949-628f42c999dc@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Raffaele Rossi <rossi.raffaele@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: This variable should not be named: an identifier
 (not) to remember
Date: Thu, 30 Mar 2017 09:25:39 -0700 (PDT)
Lines: 99
Approved: news@gmane.org
Message-ID: <fb4d95ca-355d-4248-8949-628f42c999dc@isocpp.org>
References: <985b9b2a-c734-45eb-95f4-db4dc0d309a1@isocpp.org>
 <00f80877-4564-406b-9dc5-d2d961b8dce3@isocpp.org>
 <ee6468dd-02b5-4fe8-a669-8a11d753489c@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2799_847978691.1490891139645"
X-Trace: blaine.gmane.org 1490891150 11774 195.159.176.226 (30 Mar 2017 16:25:50 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 30 Mar 2017 16:25:50 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC6IBYFLW4MRBBHD6TDAKGQEOKZ5GQQ@isocpp.org Thu Mar 30 18:25:46 2017
Return-path: <std-proposals+bncBC6IBYFLW4MRBBHD6TDAKGQEOKZ5GQQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f197.google.com ([209.85.213.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC6IBYFLW4MRBBHD6TDAKGQEOKZ5GQQ@isocpp.org>)
	id 1ctctD-0001lq-Ew
	for gclcip-std-proposals@m.gmane.org; Thu, 30 Mar 2017 18:25:35 +0200
Original-Received: by mail-yb0-f197.google.com with SMTP id p83sf5378987yba.4
        for <gclcip-std-proposals@m.gmane.org>; Thu, 30 Mar 2017 09:25:41 -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
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=0Cxqu+pz13hCZzvaQTS9wczRiIj5kudMRtIjU+HEUtA=;
        b=UNTdoHPYE3tF2nHqfLW/S6YLdDPQif0jztbFpbH99r9XBSipIhrA3iIEKIRX/zr9Bt
         4c7z/QrzhNlWxpgxNN1A+rPAeXwjSIdGIjHABtFl+KOf73j4LMcV7WsTqtnZbXi/cx6t
         PDO31L7nQ+NeM4Bniw/xHuTuno62t3vAYUMgKw4aqLPfhlwkqdWq/s7Al3yKuRUN2GO4
         suaLyIS5U4/lx50eimJ+2DS7a4Se3ba47rMrkXoLK69OGp6h3Irqk02R23duMIyVQb8h
         TgOch4uRpjom6Wv6rhU7xVI3p/biLce/3uMpGjDEH2m3awzuJbywxkaWfvCPw5dExgue
         VOJg==
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
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=0Cxqu+pz13hCZzvaQTS9wczRiIj5kudMRtIjU+HEUtA=;
        b=sSI6uRJY5KoTjLwgooRTxSqlOk/3ctG1qy2cgymli+awnW/YEGI+dUAv3Mpkj2xXcz
         lS/IyCdTT5avwV/b60BJJvv7H7syf/lLSQMJ4/dgIeh+dNTsRxnkXxObgLaRQUgSOHLo
         C4D15hw9K449wLTCQ6vqu5rkyiUdQNEa/bNmAAobTy2N5md2f2e6bzO9xvf1j/lZrhg6
         /2A3TY6O9TytPsoJqTcPv4wLqdPK2xYipHOMpxKd4FQ64JMl0H5XtP5/i2S0SGtedFFq
         4haOaWsumvdCjjI/ki4H+G8y06u+wgUAHlRqyoIcLgl+BGOxCdBdH4wYGsN716fn5t1r
         ki7g==
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=0Cxqu+pz13hCZzvaQTS9wczRiIj5kudMRtIjU+HEUtA=;
        b=EPERW2ktiMolip4y0cqqlIC3Jlwll8twyxDU2N+20xKzcBb6dsqqbfkqscC3H1dTaB
         g8QV9/g5g3qgsfQto4P7kqIUOoOHjx0Fa7TEeXEwvXZgY+H0f91fSvX2m4f4xyiEsQqu
         ibXMvRXfbVl+U7eBriJkXaqXpJoqzr7XxyeYOwp2He02aT836IrxaO8FLJsNZdPrZ2Fi
         tW2TLYHgatY+3Cc3PLE2F1UbX5qMrVRC0l7TPTeWzngWnqWQb4lnE9qxQjCzM54SRRSq
         hQoA9yTn6YEbGEp7cnu0uaeaALvfPjviJ7pT9KEzdzK5M2Tcsl+uCKG73ij5enNWVL8b
         WotQ==
X-Gm-Message-State: AFeK/H02eqeZNMC0Uc8gOXpzZZ1SCJM+6SLdI0Izqtbq/TPsOVmr0RtCYpGPqAwxOhUGGg==
X-Received: by 10.129.82.134 with SMTP id g128mr223380ywb.18.1490891141062;
        Thu, 30 Mar 2017 09:25:41 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.39.115 with SMTP id r106ls448924ota.10.gmail; Thu, 30 Mar
 2017 09:25:40 -0700 (PDT)
X-Received: by 10.157.9.183 with SMTP id q52mr56500otd.11.1490891140168;
        Thu, 30 Mar 2017 09:25:40 -0700 (PDT)
In-Reply-To: <ee6468dd-02b5-4fe8-a669-8a11d753489c@isocpp.org>
X-Original-Sender: rossi.raffaele@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:31903
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31903>

------=_Part_2799_847978691.1490891139645
Content-Type: multipart/alternative; 
	boundary="----=_Part_2800_1482505948.1490891139645"

------=_Part_2800_1482505948.1490891139645
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

You only add a scope if you need it, i.e to lock only a section of a=20
function, in which case you have to create a scope anyway:

void foo() {
    // do stuff
    {
        unique_lock __{mutex};
    }
}

And between the two, doing using(...) { } is also more explicit on the=20
intention, instead of just opening a "anonymous" scope, isn't it?

Il giorno gioved=C3=AC 30 marzo 2017 15:36:10 UTC+1, Nicol Bolas ha scritto=
:
>
> On Thursday, March 30, 2017 at 4:12:46 AM UTC-4, Raffaele Rossi wrote:
>>
>> Wouldn't it be much better to have a concept of Context?
>>
>
> Why would I want to introduce a whole new scope when simply declaring an=
=20
> unnamed variable is sufficient? It's adding pointless braces for somethin=
g=20
> that C++ gives by default.
>
> Other languages use this syntax because they *don't* provide RAII by=20
> default. C++ does, so there's no need for explicit syntax to say what we=
=20
> normally have.
>

--=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/fb4d95ca-355d-4248-8949-628f42c999dc%40isocpp.or=
g.

------=_Part_2800_1482505948.1490891139645
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>You only add a scope if you need it, i.e to lock only=
 a section of a function, in which case you have to create a scope anyway:<=
br></div><div><br></div><div><font face=3D"courier new, monospace">void foo=
() {</font></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 /=
/ do stuff</font></div><div><font face=3D"courier new, monospace">=C2=A0 =
=C2=A0 {</font></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 unique_lock __{mutex};</font></div><div><font face=3D"cou=
rier new, monospace">=C2=A0 =C2=A0 }<br>}</font></div><div><br>And between =
the two, doing <font face=3D"courier new, monospace">using(...) { }</font> =
is also more explicit on the intention, instead of just opening a &quot;ano=
nymous&quot; scope, isn&#39;t it?<br><br>Il giorno gioved=C3=AC 30 marzo 20=
17 15:36:10 UTC+1, Nicol Bolas ha scritto:<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">On Thursday, March 30, 2017 at 4:12:46 AM UTC-=
4, Raffaele Rossi wrote:<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>Wouldn&#39;t it be much better to have a concept of Context?</di=
v></div></blockquote><div><br>Why would I want to introduce a whole new sco=
pe when simply declaring an unnamed variable is sufficient? It&#39;s adding=
 pointless braces for something that C++ gives by default.<br><br>Other lan=
guages use this syntax because they <i>don&#39;t</i> provide RAII by defaul=
t. C++ does, so there&#39;s no need for explicit syntax to say what we norm=
ally have.<br></div></div></blockquote></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/fb4d95ca-355d-4248-8949-628f42c999dc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fb4d95ca-355d-4248-8949-628f42c999dc=
%40isocpp.org</a>.<br />

------=_Part_2800_1482505948.1490891139645--

------=_Part_2799_847978691.1490891139645--

.
