220 14359 <29844029-ae80-4fed-8a17-2a56b805fea5@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: robinsfr@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal for a delete expression for local variables
Date: Sat, 1 Nov 2014 06:23:27 -0700 (PDT)
Lines: 91
Approved: news@gmane.org
Message-ID: <29844029-ae80-4fed-8a17-2a56b805fea5@isocpp.org>
References: <e8ee92d8-0018-45a2-b87a-2d87f13047b4@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_483_65691817.1414848208025"
X-Trace: ger.gmane.org 1414848219 8360 80.91.229.3 (1 Nov 2014 13:23:39 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 1 Nov 2014 13:23:39 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCQ5LBULYYOBBUN52ORAKGQEMFNTUAA@isocpp.org Sat Nov 01 14:23:32 2014
Return-path: <std-proposals+bncBCQ5LBULYYOBBUN52ORAKGQEMFNTUAA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f69.google.com ([209.85.218.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCQ5LBULYYOBBUN52ORAKGQEMFNTUAA@isocpp.org>)
	id 1XkYeR-0006EX-2y
	for gclcip-std-proposals@m.gmane.org; Sat, 01 Nov 2014 14:23:31 +0100
Original-Received: by mail-oi0-f69.google.com with SMTP id e131sf37406818oig.4
        for <gclcip-std-proposals@m.gmane.org>; Sat, 01 Nov 2014 06:23:30 -0700 (PDT)
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
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=gR0ZPsUBlPie5ULWPVsVDWADEQh4loOpQPK9oSWeEzY=;
        b=EdMUlYubfcM8GfMnUCQKUMpG4JrXG0Jehy8PnSXD/s8siBebqNKNFgeNcfYvDlmD8m
         wsi8mKvL6pRvEa7Rom8fUfYXedlfeO2+ERvPBe279x4Nv9NuHginMNbIy7fB9AF2Jp7P
         INnqhjfera1wIUJmdTr5tXwKZKAOXpT8wTqm3yyKhwrVQvdJYA2rDf/fzHO8+xiO8AH0
         Lcmq0padetEOIEfSReRPkYoCP+58zkCSmturR7ezla6YzfE77LSkA9ItM2jg7KgLOACO
         ZUekvP1NSd5oc71h842u/iWo8KffY/014BkcX3TK/hqxpzkmU+2zctJfkiHO20VcDLYR
         fGaA==
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:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=gR0ZPsUBlPie5ULWPVsVDWADEQh4loOpQPK9oSWeEzY=;
        b=at+Iv4mnsfGRtSbTUWP/SEsgn+rqYRT+cu8DhH6PjCqz1wD4RC2MwSu6GN5Jrnc8kK
         C12T7CXv/hcvuCXohFywiauOT+1uqGAuo7I7B7oE9ZTgkePkJBwX8Faij6iGuAzKmQMt
         H2gn6OGquivZ09ivHGpDmcZ0GkHJyHf3Ov8bJRQkEe7HU+mPGpNwSXLe0QnAzyBr5Sgw
         AoHlKmUEA2Nil3MeLObzPbhHebkxueZDBCM+Trr2SOAxqt5s4oms/e7IDQQOO11NOm2x
         fUAyx/V+7JQg/cch+OD0h8Mxf12zrjzP/CjEdwhfkM+eU7ItNccVllAwsDMmVln5p5xG
         6Lpw==
X-Gm-Message-State: ALoCoQkEVPaN0VTTNHXIx1kVCyVbx5N22RVRsHnCuAjqEf/NwCG5ylFunpWGccNoD8UFu1em2Nbu
X-Received: by 10.43.1.138 with SMTP id nq10mr23534633icb.17.1414848209995;
        Sat, 01 Nov 2014 06:23:29 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.4.8 with SMTP id g8ls450311igg.42.canary; Sat, 01 Nov 2014
 06:23:29 -0700 (PDT)
X-Received: by 10.51.16.65 with SMTP id fu1mr34761igd.10.1414848209408;
        Sat, 01 Nov 2014 06:23:29 -0700 (PDT)
In-Reply-To: <e8ee92d8-0018-45a2-b87a-2d87f13047b4@isocpp.org>
X-Original-Sender: robinsfr@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:14359
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/14359>

------=_Part_483_65691817.1414848208025
Content-Type: text/plain; charset=UTF-8

Consider 'finalize' and 'dispose' as a candidate words too, as they are 
shorter and has some precedent in other languages (Java and C#). I like 
your ambition of having a consistent way to finalize a resource without 
needing to remember the specific method names for each different type 
(Close a handle but Free that thing and Destroy that other thing), and 
introducing artificial scope via braces is just awkward sometimes. The 
common case where I encounter this is when needing to briefly lock a 
section of code for reading a variable, which makes braces weird because 
you actually want to *keep* the scope of the object being read under lock.

What I want to do:
....
    LockHolder lockHolder(object.GetLock());
    String s = object.GetString();
    finalize lockHolder;
....

What I end up doing:
....
    String s;
    {
        LockHolder lockHolder(object.GetLock());
        s = object.GetString();
    }
....

The assignment is trivial in this case for a std::string, but declaring a 
variable first with the default constructor only to replace it later is 
silly.

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_483_65691817.1414848208025
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Consider 'finalize' and 'dispose' as a candidate word=
s too, as they are shorter and has some precedent in other languages (Java =
and C#). I like your ambition of having a consistent way to finalize a reso=
urce without needing to remember the specific method names for each differe=
nt type (Close a handle but Free that thing and Destroy that other thing), =
and introducing artificial scope via braces is just awkward sometimes. The =
common case where I encounter this is when needing to briefly lock a sectio=
n of code for reading a variable, which makes braces weird because you actu=
ally want to <em>keep</em> the scope of the object being read under lock.</=
div><div><br></div><div>What I want to do:</div><div><font face=3D"courier =
new,monospace">...</font></div><div><font face=3D"courier new,monospace">&n=
bsp; &nbsp; LockHolder lockHolder(object.GetLock());</font></div><div><font=
 face=3D"courier new,monospace">&nbsp; &nbsp; String s =3D object.GetString=
();</font></div><div><font face=3D"courier new,monospace">&nbsp; &nbsp; fin=
alize lockHolder;</font></div><div><font face=3D"courier new,monospace">...=
</font></div><div><font face=3D"courier new,monospace"><br></font></div><di=
v>What I end up doing:</div><div><font face=3D"courier new,monospace">...</=
font></div><div><font face=3D"courier new,monospace">&nbsp; &nbsp; String s=
;</font></div><div><font face=3D"courier new,monospace">&nbsp; &nbsp; {</fo=
nt></div><div><font face=3D"courier new,monospace">&nbsp; &nbsp; &nbsp; &nb=
sp; LockHolder lockHolder(object.GetLock());</font></div><div><font face=3D=
"courier new,monospace">&nbsp; &nbsp; &nbsp; &nbsp; s =3D object.GetString(=
);</font></div><div><font face=3D"courier new,monospace">&nbsp; &nbsp; }</f=
ont></div><div><font face=3D"courier new,monospace">...</font></div><div><b=
r></div><div>The assignment is trivial in this case for a std::string, but =
declaring a variable first with the default constructor only to replace it =
later is silly.<font face=3D"courier new,monospace"><br></font></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_483_65691817.1414848208025--

.
