220 31805 <58DA6B66.2010307@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: Tue, 28 Mar 2017 09:55:50 -0400
Lines: 51
Approved: news@gmane.org
Message-ID: <58DA6B66.2010307@gmail.com>
References: <985b9b2a-c734-45eb-95f4-db4dc0d309a1@isocpp.org>
 <CAFk2RUZ3+yru+cYSEtxJ1TbZuyWp71gpCGoq=WE_8EAE=+h=2g@mail.gmail.com>
 <7EF863A1-1454-4116-9164-676FF19BF923@gmail.com>
 <CAA7YVg1m+ZHyDdVf6UCVL98Ne_FvGt6SMNZd4OUgY3pHFyxNwg@mail.gmail.com>
 <CAF3xnJSBMmyno-AksyJJz5W=K4J=uY-ynYys3+v=mf5EzCp07w@mail.gmail.com>
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 1490709365 12733 195.159.176.226 (28 Mar 2017 13:56:05 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 28 Mar 2017 13:56:05 +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+bncBC37LBFWUIFBB2OW5HDAKGQECOVDKCQ@isocpp.org Tue Mar 28 15:56:00 2017
Return-path: <std-proposals+bncBC37LBFWUIFBB2OW5HDAKGQECOVDKCQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f70.google.com ([209.85.214.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC37LBFWUIFBB2OW5HDAKGQECOVDKCQ@isocpp.org>)
	id 1csrbA-0001fc-37
	for gclcip-std-proposals@m.gmane.org; Tue, 28 Mar 2017 15:55:48 +0200
Original-Received: by mail-it0-f70.google.com with SMTP id n130sf12730549ita.15
        for <gclcip-std-proposals@m.gmane.org>; Tue, 28 Mar 2017 06:55:54 -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=il3z16t0yykuemlPOp4yuu5S2dMT09+zLXIGM+GhW7I=;
        b=j1vLJYU32Ve4f8ZFyHCZW0AwASLU1wyeMvSN0x1DCJEdvUw9ejiBxn2cGALDd25lp8
         hq/ncJI4PfrI/ABORD7uO9L9noe660G3/MRhWISMPcXvVeEmiOEidIzxEHVlFEog8TUy
         3odd/YrDuEuict3BkjdEpLY0fDzsjDsdv4Wqjw+njgqpCKurv1jO4mwqvogdSP+a1hkr
         iBTgUZMCvYuG1L3mAIIXdt6BhPgwFA1MTV7OOw89u2buTUKzRSjmYE6wPPsytSfPlWnS
         8UVD8jPF7gT4zXK+9ElHXJ3I2JUUv5hdTYyCplTo771HZSZ0u1xfnnxSIHqd4CmtYway
         wISQ==
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=il3z16t0yykuemlPOp4yuu5S2dMT09+zLXIGM+GhW7I=;
        b=T9+JxsgOZGIxwO1ry0pf16xSPzRKBNrXfABwLiV0q7Qe1p+6ekN7lRRHnbRywD6uWN
         /uRekfs07tcSi1UjZcAIaxxKARiBhZrHwpBr+be6V8uI5cJNoWpMrEo6V8MnzkCLvok+
         2rpStWUhMujS8kEG6GDlE5Cz8SIQ/BmC404TjZYKxmfObbWQpVBjliMaoqeg7RTXK+Lp
         dQIEsXJwyjmLP3PuHnRFFsPfoOwUZx59fDi4dwtwKuD14v7iBccypEeGlBLD75Pwp4qW
         y1QxAuoMDI2v//+QyHRV8S8ucQbPMendEjDJ2NRgLjxmRZD/Cvqoiq/oX9XigQax2vVV
         fJZA==
X-Gm-Message-State: AFeK/H0oL7m8XjEPYPdG8QVABuz0ATuX2p6+IFu9IuUAavYsg79luuryPMfmpGFVY81viw==
X-Received: by 10.107.136.36 with SMTP id k36mr8564430iod.41.1490709353917;
        Tue, 28 Mar 2017 06:55:53 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.17.215 with SMTP id y23ls15700878oty.7.gmail; Tue, 28 Mar
 2017 06:55:53 -0700 (PDT)
X-Received: by 10.157.11.183 with SMTP id 52mr4659380oth.14.1490709353073;
        Tue, 28 Mar 2017 06:55:53 -0700 (PDT)
Original-Received: from mail-oi0-x241.google.com (mail-oi0-x241.google.com. [2607:f8b0:4003:c06::241])
        by mx.google.com with ESMTPS id p44si2078340otd.76.2017.03.28.06.55.53
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 28 Mar 2017 06:55:53 -0700 (PDT)
Received-SPF: pass (google.com: domain of mwoehlke.floss@gmail.com designates 2607:f8b0:4003:c06::241 as permitted sender) client-ip=2607:f8b0:4003:c06::241;
Original-Received: by mail-oi0-x241.google.com with SMTP id b187so848384oif.3
        for <std-proposals@isocpp.org>; Tue, 28 Mar 2017 06:55:53 -0700 (PDT)
X-Received: by 10.202.77.202 with SMTP id a193mr15058129oib.69.1490709352718;
        Tue, 28 Mar 2017 06:55:52 -0700 (PDT)
Original-Received: from [192.168.1.176] (tripoint.kitware.com. [66.194.253.20])
        by smtp.googlemail.com with ESMTPSA id h10sm1686289oia.41.2017.03.28.06.55.51
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 28 Mar 2017 06:55:52 -0700 (PDT)
Original-Newsgroups: gmane.comp.lang.c++.isocpp.proposals
In-Reply-To: <CAF3xnJSBMmyno-AksyJJz5W=K4J=uY-ynYys3+v=mf5EzCp07w@mail.gmail.com>
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:4003:c06::241 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:31805
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31805>

On 2017-03-28 05:23, Alberto Barbati wrote:
> 2017-03-28 11:08 GMT+02:00 Viacheslav Usov <via.usov@gmail.com>:
>> This keeps coming back to this forum. For example, this:
>> https://groups.google.com/a/isocpp.org/d/msg/std-proposals/ioi76TkG6g4/
>> G8WC37LVAAAJ
>>
>> My take on this is that we should have an operator or a keyword that
>> extends the lifetime of a temporary, as discussed here
>> https://groups.google.com/a/isocpp.org/d/msg/std-
>> proposals/ioi76TkG6g4/bdUinF-3AQAJ and subsequent posts, notably this
>> https://groups.google.com/a/isocpp.org/d/msg/std-
>> proposals/ioi76TkG6g4/bdUinF-3AQAJ and this https://groups.google.
>> com/a/isocpp.org/d/msg/std-proposals/ioi76TkG6g4/5JrGmugAAgAJ
> 
> Thanks for taking the time to collect these links, I will have a look at
> them.
> 
> As for having a keyword to extend the lifetime of a temporary, there is a
> formal proposal for that (http://wg21.link/p0577), which I referenced in my
> draft. However I believe P0577 does not address the issue of decomposition
> declarations and has a greater syntactic cost (it re-uses the "register"
> keyword). It's true that P0577 provides additional use cases, though, but I
> am yet to be convinced of their usefulness.

The main use case for `register` as lifetime extension is that you can
use it like:

  for (auto item : add_const(register make_list()))

....where you would otherwise need an additional declaration. The
decomposition case I think would be best solved by allowing empty and
nested declarations. See
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/gg3_eUhCuqo/HcippDFiBgAJ
and following posts in the thread. This would let you write:

  auto [] = get_lock(); // no name
  auto [x, [], y] = get_tuple(); // middle element is unnamed
  auto [x, [a, b], y] = get_tuple(); // nested decomposition

Both solve the simple case, but both also have additional but
non-overlapping usefulness. I'm inclined to think that both are useful.

-- 
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/58DA6B66.2010307%40gmail.com.

.
