220 28004 <997FEFE7601FB061.100935c7-c671-4405-9c66-74522255c54e@mail.outlook.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: jsphadetula@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: Sun, 28 Aug 2016 09:58:56 +0000 (UTC)
Lines: 226
Approved: news@gmane.org
Message-ID: <997FEFE7601FB061.100935c7-c671-4405-9c66-74522255c54e@mail.outlook.com>
References: <ec2e95cc-3ef0-435b-aaf9-13e982c4583e@isocpp.org>
 <CAA7YVg3dJT3LY_L5Eg=ZNgfqqyOcX9P=JVv_pXTEx6xxsoGOdg@mail.gmail.com>
 <CAE7XuEWr7eyyjmqURnMwQf1pvyvHeMATM1MDjRY=25WuGy5Z=w@mail.gmail.com>
 <16f4f27a-daf4-4eff-8408-73aadc99e0c5@isocpp.org>
 <e94c3ab8-e064-4dcb-a702-3999a877d264@isocpp.org>
 <CACGiwhEWxXQbm60FDcAxH+KA3rMnFcpvRnpbUBaQ-HtGuZwzAQ@mail.gmail.com>
 <52303ad8-6485-49e6-b797-da61d270627e@isocpp.org>
 <CACGiwhF_PGSqbfROx5tvxDBj0nsTpao3kOKqSGzpsKmTDwTjTQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_3662_706498864.1472378336052"
X-Trace: blaine.gmane.org 1472378343 5270 195.159.176.226 (28 Aug 2016 09:59:03 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 28 Aug 2016 09:59:03 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCF6REN4VUERBYXLRK7AKGQENJRENQI@isocpp.org Sun Aug 28 11:58:58 2016
Return-path: <std-proposals+bncBCF6REN4VUERBYXLRK7AKGQENJRENQI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f69.google.com ([209.85.214.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCF6REN4VUERBYXLRK7AKGQENJRENQI@isocpp.org>)
	id 1bdwrh-0000yv-RX
	for gclcip-std-proposals@m.gmane.org; Sun, 28 Aug 2016 11:58:58 +0200
Original-Received: by mail-it0-f69.google.com with SMTP id x131sf69338950ite.0
        for <gclcip-std-proposals@m.gmane.org>; Sun, 28 Aug 2016 02:58:59 -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: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=kCdvc2DyQ+KoZ0cYV1wHuuzgG1QMtB2EO6F5Ma08gpg=;
        b=q283beTGpz9GPMwCP7jBonhVl2CTFuSJSEK4Nr0NsYUwBD0QXTDu5wCiakIB1QwTNU
         58SC09wAYYCQ3E6UvnhyZxYmWuiagzEUOGIZogx9xaeMY/gQmnyrpbevwF/jEIIRvCde
         YhpJyFYw57/8XVMGaISExi6shyX2x5W4ufUpS5xVpXzbI7+R49LzGYyHEGPummLo0Hdt
         7JFL1dCtvW48jkRPcGbklr34GVq4me4anDdz60XZoKXn7g0ieiKpLvPVS5YkXtiFiAEU
         xEP3dj+UKJeLbZ3iAbvHfNTtXSqtV6Mp1Qr6P38+UxhwTpNwOj9S5kn4x3j77aaUoCaL
         LV9A==
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
         :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=kCdvc2DyQ+KoZ0cYV1wHuuzgG1QMtB2EO6F5Ma08gpg=;
        b=TDK4Ey0hYANQHAJGIjlmW5wEUrtBVY87B6ng3Fm46twBcCNcEJRT+QKy7+ReA0USFI
         fTgJ2ZN4JEKKG5FOkkuNQ1dcYD7Ozs/gaPDEfJd1uMxuzCkmT9L61iQv/oG8P/vKQAJS
         nvEDAbl7zkUl3rHe8N/WZNG6SkYJfj/Pgb0lVq+NmQN2wYhlni/JsKPFsuh9cTZrkdg8
         /il6GugJlNGMYeco4jIiWdWZTTRohsreSuag7L+4bCb/Z03AyBeHHR24pziq8/vkbAKI
         Ji+m7heIk/MWceg16pbnlNSHRJ/5AboKRwyPknyygU8UZYMdyqv8FnH09KEBbRw9c7Ca
         yGNg==
X-Gm-Message-State: AE9vXwNtMpYuxd5phjhARw3HtDAJFm/X3osixq5JTUq1+XzlbXmiDS22BsCS8OAgYc5/2w==
X-Received: by 10.157.22.234 with SMTP id s39mr2035636ots.26.1472378338571;
        Sun, 28 Aug 2016 02:58:58 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.238.5 with SMTP id b5ls2876231iti.3.gmail; Sun, 28 Aug 2016
 02:58:57 -0700 (PDT)
X-Received: by 10.98.23.134 with SMTP id 128mr22066777pfx.96.1472378337859;
        Sun, 28 Aug 2016 02:58:57 -0700 (PDT)
Original-Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com. [2607:f8b0:400e:c03::22b])
        by mx.google.com with ESMTPS id x184si32544182pfb.210.2016.08.28.02.58.57
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 28 Aug 2016 02:58:57 -0700 (PDT)
Received-SPF: pass (google.com: domain of jsphadetula@gmail.com designates 2607:f8b0:400e:c03::22b as permitted sender) client-ip=2607:f8b0:400e:c03::22b;
Original-Received: by mail-pa0-x22b.google.com with SMTP id cy9so19381015pac.0
        for <std-proposals@isocpp.org>; Sun, 28 Aug 2016 02:58:57 -0700 (PDT)
X-Received: by 10.66.134.165 with SMTP id pl5mr154166pab.98.1472378337530;
        Sun, 28 Aug 2016 02:58:57 -0700 (PDT)
Original-Received: from mail.outlook.com (ec2-50-112-144-222.us-west-2.compute.amazonaws.com. [50.112.144.222])
        by smtp.gmail.com with ESMTPSA id n13sm40995337pfj.16.2016.08.28.02.58.56
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 28 Aug 2016 02:58:56 -0700 (PDT)
In-Reply-To: <CACGiwhF_PGSqbfROx5tvxDBj0nsTpao3kOKqSGzpsKmTDwTjTQ@mail.gmail.com>
X-Mailer: Outlook for iOS and Android
X-Original-Sender: jsphadetula@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 jsphadetula@gmail.com designates 2607:f8b0:400e:c03::22b as permitted sender)
 smtp.mailfrom=jsphadetula@gmail.com;       dmarc=pass (p=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:28004
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28004>

------=_Part_3662_706498864.1472378336052
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable





<some_syntax> varName;


what if <some_syntax>=C2=A0is explicitly applied on the intended last use o=
f varName after which any reference to varName will be treated as compile t=
ime error=20


in summary make <some_syntax>=C2=A0end the scope of varName even before the=
 end of the current scope


Get Outlook for Android






On Sun, Aug 28, 2016 at 9:06 AM +0100, "D. B." <db0451@gmail.com> wrote:










On Sat, Aug 27, 2016 at 11:48 PM, Nicol Bolas <jmckesson@gmail.com> wrote:

Hmm. At first, I didn't like the idea of it being merely a hint to the opti=
mizer. When a destructor gets called is an observable side-effect for any c=
ode where we would care to use such a thing. So it should be something you =
could rely on.

After thinking about it for a bit however, making it a hint does solve a nu=
mber of issues.

Heh, I thought I was just inferring what you meant, but instead I came up w=
ith a new idea. That was unexpectedly useful! The rest of what you said is =
a good (probably better than I could've written) outline of what I was thin=
king. So thanks! Although:

=C2=A0That said, I wonder how likely this is, given that by my understandin=
g, we're far into GC territory. But as a non-binding hint to the compiler t=
hat wouldn't affect semantics of well-formed programs, maybe it's not that =
outlandish at all... we have several of those already.

But it would affect the semantics of well-formed programs. See my tuple exa=
mple above; if `T t` had been annotated with the attribute, then it would m=
ake use of `tpl` without the use of `t` undefined behavior. That's part of =
the promise you make when you use [[eager-destruct]] or whatever we call it=
..

It's no different from [[noreturn]] in that regard; if such a function ever=
 actually returns, you provoke UB.






Not sure if this was an imprecise choice of words on my part. But what I re=
ally meant was precisely what you said:
the new behaviour could not suddenly wreck any current, working, compliant =
programs - since it'd be an opt-in attribute, and
if one deliberately added said attribute but also stashed a reference to an=
 object for which it was declared they would not, the program might compile=
, but it's on the programmer's head if=C2=A0 the optimisation process bites=
 them, as doing so would be UB.








--=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/CACGiwhF_PGSqbfROx5tvxDBj0nsTpao3kOKqSGzpsKmTDwT=
jTQ%40mail.gmail.com.






--=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/997FEFE7601FB061.100935c7-c671-4405-9c66-7452225=
5c54e%40mail.outlook.com.

------=_Part_3662_706498864.1472378336052
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><p dir=3D"auto"><br>
&lt;some_syntax&gt; varName;</p>
<p dir=3D"auto">what if &lt;some_syntax&gt;&nbsp;is explicitly applied on t=
he intended last use of varName after which any reference to varName will b=
e treated as compile time error </p>
<p dir=3D"auto">in summary make &lt;some_syntax&gt;&nbsp;end the scope of v=
arName even before the end of the current scope</p>
<p dir=3D"auto">Get <a href=3D"https://aka.ms/ghei36">Outlook for Android</=
a><br>
</p>
<br><br><br>
<div class=3D"gmail_quote">On Sun, Aug 28, 2016 at 9:06 AM +0100, "D. B." <=
span dir=3D"ltr">&lt;<a href=3D"mailto:db0451@gmail.com" target=3D"_blank">=
db0451@gmail.com</a>&gt;</span> wrote:<br>
<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">




<div dir=3D"3D&quot;ltr&quot;">
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On S=
at, Aug 27, 2016 at 11:48 PM, Nicol Bolas <span dir=3D"ltr">&lt;<a href=3D"=
mailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>&gt;</=
span> wrote:<br><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"><span class=
=3D""></span><br><div>Hmm. At first, I didn't like the idea of it being mer=
ely a hint to the optimizer. When a destructor gets called is an observable=
 side-effect for any code where we would care to use such a thing. So it sh=
ould be something you could rely on.<br><br>After thinking about it for a b=
it however, making it a hint does solve a number of issues.<br></div></div>=
</blockquote><div><br></div><div>Heh, I thought I was just inferring what y=
ou meant, but instead I came up with a new idea. That was unexpectedly usef=
ul! The rest of what you said is a good (probably better than I could've wr=
itten) outline of what I was thinking. So thanks! Although:<br><br>&nbsp;</=
div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div></div><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>T=
hat said, I wonder how likely this is, given that by my understanding, we'r=
e far into GC territory. But as a non-binding hint to the compiler that wou=
ldn't affect semantics of well-formed programs, maybe it's not that outland=
ish at all... we have several of those already.<br></div></blockquote></spa=
n><div><br>But it would affect the semantics of well-formed programs. See m=
y tuple example above; if `T t` had been annotated with the attribute, then=
 it would make use of `tpl` without the use of `t` undefined behavior. That=
's part of the promise you make when you use [[eager-destruct]] or whatever=
 we call it.<br><br>It's no different from [[noreturn]] in that regard; if =
such a function ever actually <i>returns</i>, you provoke UB.<br></div></di=
v><span class=3D"">

<p></p>

</span></blockquote><div>Not sure if this was an imprecise choice of words =
on my part. But what I really meant was precisely what you said:<br><ul><li=
>the new behaviour could not suddenly wreck any <i>current</i>, working, co=
mpliant programs - since it'd be an opt-in attribute, and<br></li></ul><ul>=
<li>if one deliberately <i>added</i> said attribute but also stashed a refe=
rence to an object for which it was declared they would not, the program mi=
ght compile, but it's on the programmer's head if&nbsp; the optimisation pr=
ocess bites them, as doing so would be UB.</li></ul><p><br></p></div></div>=
</div></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" 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/CACGiwhF_PGSqbfROx5tvxDBj0nsTpao3kOKq=
SGzpsKmTDwTjTQ%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhF_PGSq=
bfROx5tvxDBj0nsTpao3kOKqSGzpsKmTDwTjTQ%40mail.gmail.com</a>.<br>

</div>

</blockquote>
</div>
</body></html>

<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/997FEFE7601FB061.100935c7-c671-4405-9=
c66-74522255c54e%40mail.outlook.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/997FEFE7601FB=
061.100935c7-c671-4405-9c66-74522255c54e%40mail.outlook.com</a>.<br />

------=_Part_3662_706498864.1472378336052--

.
