220 31898 <58DD162C.30902@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@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 10:29:00 -0400
Lines: 50
Approved: news@gmane.org
Message-ID: <58DD162C.30902@gmail.com>
References: <985b9b2a-c734-45eb-95f4-db4dc0d309a1@isocpp.org>
 <00f80877-4564-406b-9dc5-d2d961b8dce3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: blaine.gmane.org 1490884146 14055 195.159.176.226 (30 Mar 2017 14:29:06 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 30 Mar 2017 14:29:06 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
 Thunderbird/38.1.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBBLVM6TDAKGQEX6BHAGA@isocpp.org Thu Mar 30 16:29:02 2017
Return-path: <std-proposals+bncBC37LBFWUIFBBLVM6TDAKGQEX6BHAGA@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+bncBC37LBFWUIFBBLVM6TDAKGQEX6BHAGA@isocpp.org>)
	id 1ctb4L-0002nP-Re
	for gclcip-std-proposals@m.gmane.org; Thu, 30 Mar 2017 16:28:58 +0200
Original-Received: by mail-vk0-f71.google.com with SMTP id l65sf21285102vkd.11
        for <gclcip-std-proposals@m.gmane.org>; Thu, 30 Mar 2017 07:29:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:newsgroups:from:message-id:date:user-agent
         :mime-version:in-reply-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=p894opC82nw7dWNWT24LOJF0QV4DaerE0zu7PcL4iCY=;
        b=FhihtLGlkZbWWE7Xp35z12vZmCLLac/BrXta31sOZfLfHeHXTByDUNI5Is/DvOi6Xk
         WWdVhtwhHhpn28lTo8jigk8KbyoTMFUgvHfF8HDle9xBleo1FgTD+JE/YP/F8KSeKUb6
         3nyVCL+9kQk19ytI+mtKoAv17QJnicmJTXyTuWSesIW8gNjypnN4YV6qbxVTuVtnpiKN
         8VbN/jNTAoogwz6Vv+/yk0qBi+BRdu7QV5nr/hn1h1mLj2oQw1IJdBZWzDIsJgEZKXWl
         RG3Um8JeBQeWBCXDcVW7lZ6k4/Dn3vlK7Lrd3jNl/dZ7kAch+/hw7UGeO7E3fEO19VVM
         os7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:newsgroups:from:message-id
         :date:user-agent:mime-version:in-reply-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=p894opC82nw7dWNWT24LOJF0QV4DaerE0zu7PcL4iCY=;
        b=LczVwdFqDoeLIJz1hEb57e1ff7rqHEQhtP3ggoOCWs1TSN2TGeL/nWqTfJjkCii6n6
         jr+DpSt5ZW0+jtzZfftTT5O2IrysHrETpXlFfqErtQH5KAEBlHryISRDelZAIxxi5XKX
         rwKmdkswkqdX/MLfJsDFHHqWKnS5HkXGjqR2GSqrJT5ZYMzhLrUXvuDLWi+TDlhSoKwr
         77CEOwY9gsg4Sl+EJQHtGK1hp/oGeAptdGWoRDL+zdOGkTIfk99RqL9VhQjrUGz/g4mD
         0pnq/L7zNimEc5wshR9puh5ulqxf844P4xT6/fx70rxJKj7dOn4RjprXCDoI8z1OnWt0
         IiQQ==
X-Gm-Message-State: AFeK/H0vL6OGI6gGPBRNhDeKs8ZGuWnrCvmxOoy4xzCMe3SLit22YZnx2UR8Wy0Tk7hRGQ==
X-Received: by 10.31.242.137 with SMTP id q131mr1829vkh.38.1490884143722;
        Thu, 30 Mar 2017 07:29:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.50.212 with SMTP id y203ls6485560ioy.7.gmail; Thu, 30 Mar
 2017 07:29:02 -0700 (PDT)
X-Received: by 10.36.22.85 with SMTP id a82mr4508715ita.83.1490884142390;
        Thu, 30 Mar 2017 07:29:02 -0700 (PDT)
Original-Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com. [2607:f8b0:4001:c0b::22c])
        by mx.google.com with ESMTPS id y7si1334486itc.63.2017.03.30.07.29.02
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 30 Mar 2017 07:29:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of mwoehlke.floss@gmail.com designates 2607:f8b0:4001:c0b::22c as permitted sender) client-ip=2607:f8b0:4001:c0b::22c;
Original-Received: by mail-it0-x22c.google.com with SMTP id e75so113557572itd.1
        for <std-proposals@isocpp.org>; Thu, 30 Mar 2017 07:29:02 -0700 (PDT)
X-Received: by 10.36.92.84 with SMTP id q81mr4766197itb.46.1490884142084;
        Thu, 30 Mar 2017 07:29:02 -0700 (PDT)
Original-Received: from [192.168.1.176] (tripoint.kitware.com. [66.194.253.20])
        by smtp.googlemail.com with ESMTPSA id c91sm1420010iod.18.2017.03.30.07.29.01
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 30 Mar 2017 07:29:01 -0700 (PDT)
Original-Newsgroups: gmane.comp.lang.c++.isocpp.proposals
In-Reply-To: <00f80877-4564-406b-9dc5-d2d961b8dce3@isocpp.org>
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 mwoehlke.floss@gmail.com designates 2607:f8b0:4001:c0b::22c as permitted
 sender) smtp.mailfrom=mwoehlke.floss@gmail.com;       dmarc=pass (p=NONE
 sp=NONE dis=NONE) header.from=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:31898
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31898>

On 2017-03-30 04:12, Raffaele Rossi wrote:
> Wouldn't it be much better to have a concept of Context? I am taking 
> inspiration from python (I know they use it for RAII, but that is a 
> different discussion).
> 
> The code might look like:
> 
>   void foo() {
>     // do stuff
>     with (unique_lock{mutex}) {
>       // critical code
>     }
>     // other stuff
>   }

Or, without needing to introduce a new keyword:

  void foo() {
    // do stuff
    using (unique_lock{mutex}) {
      // critical code
    }
    // other stuff
  }

We could support both:

  using (expression) { ... }
  using (declaration = expression) { ... }

....though of course the latter is equivalent to:

  if (declaration = expression; true)

....or, y'know, just using some bare {}'s, which is probably why no one
has been enthusiastic about such a proposal. That may also be why this
direction has not been pursued more enthusiastically; anonymous
variables and/or lifetime extension just seem like a better solution...

(I'm confident this has come up before...)

-- 
Matthew

-- 
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/58DD162C.30902%40gmail.com.

.
