220 27918 <a54b7cf2-6c83-48d5-aeb6-4c179cef1520@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Specifier to cause the destructor to be called at
 last use instead of end of scope
Date: Wed, 24 Aug 2016 12:21:23 -0700 (PDT)
Lines: 117
Approved: news@gmane.org
Message-ID: <a54b7cf2-6c83-48d5-aeb6-4c179cef1520@isocpp.org>
References: <ec2e95cc-3ef0-435b-aaf9-13e982c4583e@isocpp.org> <CAFk2RUYr21ijENo+w5ooBhuu-kW2V+N+oqHyzpbO9AM5y-JfPg@mail.gmail.com>
 <466EEE26-C7BA-4CD7-A8A5-B86EB179D8F3@googlemail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_660_328973787.1472066483544"
X-Trace: blaine.gmane.org 1472066490 4520 195.159.176.226 (24 Aug 2016 19:21:30 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 24 Aug 2016 19:21:30 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBNHH666QKGQE6L3GWZY@isocpp.org Wed Aug 24 21:21:26 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBBNHH666QKGQE6L3GWZY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBNHH666QKGQE6L3GWZY@isocpp.org>)
	id 1bcdjo-0000k8-Qj
	for gclcip-std-proposals@m.gmane.org; Wed, 24 Aug 2016 21:21:24 +0200
Original-Received: by mail-ua0-f197.google.com with SMTP id m60sf50778926uam.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 24 Aug 2016 12:21:25 -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=RTr5BE0c/B6hBSaQFKBd+9Rx3ZhzDHhxkldyzEsHk3c=;
        b=TS3VDEmJx9XEfVNDlzSlGgphTkuGsQu7U6VO8hnmWlMY4thVTZYLmFlq5U8S2Bd+TR
         wt6dwPijgTfY8Xc+KYTYo7kusZ2LhyuRDVmXW5CeZsloVxXFAT1iiXSBWuEcxP4cTTD+
         R9BuCURdDG6df8XqPCbb6xOwsn8qNj5yGWmhTDNV4QQrVe51wbZLOClppejJyPow+vAV
         k8l6TZi6+GEClu3nqoF5/t9A7gRNBEoBzjrBNG3AKnXZhhDGRrRwe5b9MdbjMR1flSr1
         cQbSznP9f6+x2jKv6KXEF8CcinLino9YfM9jI0vYVQGVfOrcrB1PYwViuxQC6oegPPoz
         nkyQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        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=RTr5BE0c/B6hBSaQFKBd+9Rx3ZhzDHhxkldyzEsHk3c=;
        b=AplQN8/MHeI0/Ht6mlIh9tppextCn5E+20o9YIzlsDRpCRneVfDuddhkfTfm8081IR
         Z98hy2wvsMQrYgp5Ta0dstQMOfWPKBSCSAwQtDhjIxeJHQuaKNv2fXJFmWLMBzN5lbqH
         Io6pTWF9iBGQ4HrBmV085D4oqH0zG2Qg2T2k1fp9ym9WrcHxzGljNg9HH6zpVkoV3ziG
         ubTLqlLk9sVlU9AszWakxOYaUO2+F/jVwp6D7IRmzTw99so6hrSKmnkzOZAvm2137fKY
         00NJ12SeCr/IKpChLLJxveExu/WqIlTvkdt+pDrz9LqASXODvBl+1YoEA+WxiSWdZxVy
         QnYw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        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=RTr5BE0c/B6hBSaQFKBd+9Rx3ZhzDHhxkldyzEsHk3c=;
        b=DJezVJDmILgF1ETqnv7Jjib3UQxhHk9YlWq3PVILp34rA1Zc/o7u0m+ANqFuSwWqPE
         NHdLoZspdHlmpI2KKf7jvQvmzWTsvD9nQ8lvjfXdUpuE3R9cScChbJ/T2tyWpZ73Pzl7
         yDTF6WPYossZOP5wPzpCtUiWvHOZItBm8o4aaY9/KbSYSRVLLl/45l+gdfunKr0ykbnL
         9wg+hQ/BW40CrwhRD7czLvefWpwr8DF/el/3WaOfqFi0qkHlFKYuaOp/7RvR7bQ17ImJ
         Gvb7jjc4YM4/dGi422e07MF1GAWSOcFvlS0EBjCPbMSVYMCC5sN3oSvBEQRiZf2Ewx2e
         OAvw==
X-Gm-Message-State: AE9vXwMTaqqOh/Dl5dJ87hWX6Q733PnrfBtxUhFDq2GRly3Y6UxvuYfU3E4OyllsEvOCMg==
X-Received: by 10.13.234.205 with SMTP id t196mr3294391ywe.20.1472066485312;
        Wed, 24 Aug 2016 12:21:25 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.46.156 with SMTP id u28ls6039654iou.14.gmail; Wed, 24 Aug
 2016 12:21:24 -0700 (PDT)
X-Received: by 10.36.120.140 with SMTP id p134mr792635itc.10.1472066484442;
        Wed, 24 Aug 2016 12:21:24 -0700 (PDT)
In-Reply-To: <466EEE26-C7BA-4CD7-A8A5-B86EB179D8F3@googlemail.com>
X-Original-Sender: jmckesson@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:27918
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/27918>

------=_Part_660_328973787.1472066483544
Content-Type: multipart/alternative; 
	boundary="----=_Part_661_69617179.1472066483544"

------=_Part_661_69617179.1472066483544
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wednesday, August 24, 2016 at 3:16:52 PM UTC-4, Bernd L=C3=B6rwald wrote=
:
>
>
> > Am 24.08.2016 um 21:01 schrieb Ville Voutilainen <ville.vo...@gmail.com=
=20
> <javascript:>>:=20
> >=20
> >> Limiting the scope with extra braces or by putting the operations in a=
=20
> >> subroutine also often isn't a desirable workaround. Note that compiler=
s=20
> have=20
> >=20
> > ..because..?=20
>
> It might sometimes be difficult to express the lifetimes as short as=20
> possible:=20
>
>   resource a; // begin minimum lifetime a=20
>   resource b; // begin minimum lifetime b=20
>   last_use (a); // end minimum lifetime a=20
>   long_task (b);=20
>   last_use (b); //end minimum lifetime b=20
>   // end current lifetime b=20
>   // end current lifetime a=20
>  =20
>

And how do you know that `b` isn't using `a`? That's the point of Ville's=
=20
"Define 'last use'." question. You cannot just look at code and know that=
=20
`a` is finished being used when the locally visible code stops using it.

Destruction of automatic objects in the reverse order of their construction=
=20
is a guarantee that the standard should not arbitrarily discard.

--=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/a54b7cf2-6c83-48d5-aeb6-4c179cef1520%40isocpp.or=
g.

------=_Part_661_69617179.1472066483544
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, August 24, 2016 at 3:16:52 PM UTC-4, Bernd L=
=C3=B6rwald wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<br>&gt; Am 24.08.2016 um 21:01 schrieb Ville Voutilainen &lt;<a href=3D"ja=
vascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"RQb6btHLDQAJ" rel=3D"=
nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" on=
click=3D"this.href=3D&#39;javascript:&#39;;return true;">ville.vo...@gmail.=
com</a>&gt;:
<br>&gt;=20
<br>&gt;&gt; Limiting the scope with extra braces or by putting the operati=
ons in a
<br>&gt;&gt; subroutine also often isn&#39;t a desirable workaround. Note t=
hat compilers have
<br>&gt;=20
<br>&gt; ..because..?
<br>
<br>It might sometimes be difficult to express the lifetimes as short as po=
ssible:
<br>
<br>=C2=A0 resource a; // begin minimum lifetime a
<br>=C2=A0 resource b; // begin minimum lifetime b
<br>=C2=A0 last_use (a); // end minimum lifetime a
<br>=C2=A0 long_task (b);
<br>=C2=A0 last_use (b); //end minimum lifetime b
<br>=C2=A0 // end current lifetime b
<br>=C2=A0 // end current lifetime a
<br>=C2=A0=20
<br></blockquote><div><br>And how do you know that `b` isn&#39;t using `a`?=
 That&#39;s the point of=20
Ville&#39;s &quot;Define &#39;last use&#39;.&quot; question. You cannot jus=
t look at code and=20
know that `a` is finished being used when the locally visible code stops us=
ing it.<br><br>Destruction of automatic objects in the reverse order of the=
ir construction is a guarantee that the standard should not arbitrarily dis=
card.<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/a54b7cf2-6c83-48d5-aeb6-4c179cef1520%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a54b7cf2-6c83-48d5-aeb6-4c179cef1520=
%40isocpp.org</a>.<br />

------=_Part_661_69617179.1472066483544--

------=_Part_660_328973787.1472066483544--

.
