220 8927 <CAOm4dOkcf65hBGv88y32KQPJzoohzUObk+dyuQvBPSM_kD7LCw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Francisco Lopes <francisco.mailing.lists@oblita.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Dnnnn - <scope_exit> RAII classes...
Date: Wed, 29 Jan 2014 16:41:25 -0200
Lines: 197
Approved: news@gmane.org
Message-ID: <CAOm4dOkcf65hBGv88y32KQPJzoohzUObk+dyuQvBPSM_kD7LCw@mail.gmail.com>
References: <fbfa1b71-bb4b-4804-90b3-bf423de62b26@isocpp.org>
	<183CB42B-6923-44A7-917A-A57638EF62E2@hsr.ch>
	<f577a664-e947-4388-908f-a468c4b0e6d0@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c20364c9b7df04f1204922
X-Trace: ger.gmane.org 1391020890 15330 80.91.229.3 (29 Jan 2014 18:41:30 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 29 Jan 2014 18:41:30 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDT3X37BUMLRBVUWUWLQKGQEI6U6V7Q@isocpp.org Wed Jan 29 19:41:35 2014
Return-path: <std-proposals+bncBDT3X37BUMLRBVUWUWLQKGQEI6U6V7Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f200.google.com ([209.85.192.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDT3X37BUMLRBVUWUWLQKGQEI6U6V7Q@isocpp.org>)
	id 1W8a4n-0001K9-9l
	for gclcip-std-proposals@m.gmane.org; Wed, 29 Jan 2014 19:41:29 +0100
Original-Received: by mail-pd0-f200.google.com with SMTP id y10sf4539078pdj.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 29 Jan 2014 10:41:28 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=ceSpPy2KFvxmM/yNgE52AE9wQ7Nhmv44yq/6uYPS9Tw=;
        b=HwzMjCppUQKuuaoy8FoxQBiMlRjF+LmJcaDeIfoQuogn0ZNXXedssQbEcSy2ReLUYP
         n6F5zHilbZ0IGPwE/iywtPlECSpZQscTHXWPUmb2pxdlGtHnj4VwCus1QMyq9GsO2knq
         lYTWEKQgOBI6BAYnjuCkAP5ePqhm/U5NO1oQEgX93sXmLscwKVGvA7rk5llr0c/Ka/fg
         qYQQS1s1pq4DxE8G3/8KQP7o5AOsfb6qLJSjgmKnDQnksPon9FrhHIkD6F26RgIpJtMZ
         Ccd7HDdFF37XJ0mfCY6MS3FGhWeiCNFegpJam0rXEC/u2FYVDYwWFkobfObBRhNTX9CE
         BU2g==
X-Gm-Message-State: ALoCoQnD7YOwspm7eURsOsR0EFNvLyidLGPCSwlPFnMHYTUFcGlMmYFYHiMLD5ETLPxQbxZelMaV
X-Received: by 10.66.227.103 with SMTP id rz7mr3371768pac.37.1391020887919;
        Wed, 29 Jan 2014 10:41:27 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.239.133 with SMTP id vs5ls425202igc.18.gmail; Wed, 29 Jan
 2014 10:41:26 -0800 (PST)
X-Received: by 10.50.194.131 with SMTP id hw3mr10348889igc.4.1391020886619;
        Wed, 29 Jan 2014 10:41:26 -0800 (PST)
Original-Received: from mail-ie0-f181.google.com (mail-ie0-f181.google.com [209.85.223.181])
        by mx.google.com with ESMTPS id k9si5451771igv.40.2014.01.29.10.41.26
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 29 Jan 2014 10:41:26 -0800 (PST)
Received-SPF: neutral (google.com: 209.85.223.181 is neither permitted nor denied by best guess record for domain of francisco.mailing.lists@oblita.com) client-ip=209.85.223.181;
Original-Received: by mail-ie0-f181.google.com with SMTP id to1so2466047ieb.40
        for <std-proposals@isocpp.org>; Wed, 29 Jan 2014 10:41:26 -0800 (PST)
X-Received: by 10.43.138.8 with SMTP id iq8mr7390370icc.37.1391020886040; Wed,
 29 Jan 2014 10:41:26 -0800 (PST)
Original-Received: by 10.64.166.197 with HTTP; Wed, 29 Jan 2014 10:41:25 -0800 (PST)
In-Reply-To: <f577a664-e947-4388-908f-a468c4b0e6d0@isocpp.org>
X-Original-Sender: francisco.mailing.lists@oblita.com
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 209.85.223.181 is neither permitted nor denied by best guess
 record for domain of francisco.mailing.lists@oblita.com) smtp.mail=francisco.mailing.lists@oblita.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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:8927
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8927>

--001a11c20364c9b7df04f1204922
Content-Type: text/plain; charset=ISO-8859-1

2013-04-15 Andrew Sandoval <sandoval@netwaysglobal.com>

> On Saturday, April 13, 2013 6:18:48 AM UTC-5, PeterSommerlad wrote:
>>
>> the loop advancement example is not very convincing because it can easily
>> be dealt with by using for() instead of while() which is much simpler than
>> the alternative you are proposing.
>>
>> I can remove that example if there is consensus.  I find it a useful
> method of preventing someone from producing a tight loop by accidentally
> creating a path in the loop that skips the advancement.
>
> I also wonder if an local struct with a destructor and a corresponding
>> variable wouldn't be simpler than the scoped example or alternatives like
>> unique_ptr or shared_ptr or boost::scoped_ptr that already provide much of
>> the functionality you are proposing.
>>
>> That horse has been beat to death already in the original thread on
> this.  The consensus was that these class are useful and serve a different
> purpose than unique_ptr.  You will find several that back your view point,
> but there is no reason for us to revisit this point.  I didn't put hundreds
> of hours into the document after we'd already had that discussion, just to
> fight that fight again now.  Please feel free to look at the previous posts.
>
>
>> The example given as Motivation B calls for a dedicated RAII class for
>> CriticalSection IMHO, so again not very convincing.
>>
>> IMHO it would greatly improve your paper if you would provide additional
>> examples showing the "uglyness" of using existing alternatives to your
>> proposal, i.e., DIY local structs with destructors, or "misusing"
>> unique_ptr/shared_ptr for that purpose, in contrast to scoped_function and
>> scoped_resource.
>>
>
> Okay, I can definitely consider that.  Anyone concur?
>

I do, and I feel Peter was not trying to bringing up the previous noise
again, but only, at the end,
to make a point on what should be the focus.


>
>> Also providing the no-delete value is not very convincing. What if all
>> values less than zero are "no-delete", or 7, 23 and 42? It complicates the
>> class and API and doesn't serve a general purpose. Usually a predicate is
>> used in other cases to provide a hook for bool checks.
>>
>> I disagree with that 100%.  In most cases resources -- real resources
> like file handles or descriptors, etc. are allocated and have either a 0 /
> nullptr or a -1 value on failure  Making the no-delete value simple saves a
> lot of duplicate code.
>

Windows WaitForMultipleObjects<http://msdn.microsoft.com/en-us/library/windows/desktop/ms687025%28v=vs.85%29.aspx>is
an example of API that, may not completely fit scoped_resource
scenery,
but may give an idea of the problem. I too, have found that the current
state fits a scenery that's not general
enough, but may cover most cases in the wild... maybe, I can't be sure
about that.


>
>
>> Just my CHF0.02 from a quick scan.
>>
>> Peter.
>>
>> Thank you for your feedback.
> Where is everyone else lately?  Is this the week that the committee is in
> meetings in Bristol?
> -Andrew Sandoval
>

By the way, I'd like to have the newer reference implementations available
in source code form (on github for example)...

Regards,
Francisco Lopes

-- 

--- 
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/.

--001a11c20364c9b7df04f1204922
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">2013-04-15 Andrew Sandoval <span dir=3D"ltr">&lt;<a href=
=3D"mailto:sandoval@netwaysglobal.com" target=3D"_blank">sandoval@netwaysgl=
obal.com</a>&gt;</span><br><div class=3D"gmail_extra"><div class=3D"gmail_q=
uote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class=3D"im">On Saturday, April 13, 2013 6:18:48 AM UTC-5, PeterSommer=
lad wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">the loop advanc=
ement example is not very convincing because it can easily be dealt with by=
 using for() instead of while() which is much simpler than the alternative =
you are proposing.
<br>
<br></blockquote></div><div>I can remove that example if there is consensus=
..=A0 I find it a useful method of preventing someone from producing a tight=
 loop by accidentally creating a path in the loop that skips the advancemen=
t.<br>
<br></div><div class=3D"im"><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x">I also wonder if an local struct with a destructor and a corresponding v=
ariable wouldn&#39;t be simpler than the scoped example or alternatives lik=
e unique_ptr or shared_ptr or boost::scoped_ptr that already provide much o=
f the functionality you are proposing.
<br>
<br></blockquote></div><div>That horse has been beat to death already in th=
e original thread on this.=A0 The consensus was that these class are useful=
 and serve a different purpose than unique_ptr.=A0 You will find several th=
at back your view point, but there is no reason for us to revisit this poin=
t.=A0 I didn&#39;t put hundreds of hours into the document after we&#39;d a=
lready had that discussion, just to fight that fight again now.=A0 Please f=
eel free to look at the previous posts.<br>
=A0<br></div><div class=3D"im"><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">The example given as Motivation B calls for a dedicated RAII class fo=
r CriticalSection IMHO, so again not very convincing.
<br>
<br>IMHO it would greatly improve your paper if you would provide additiona=
l examples showing the &quot;uglyness&quot; of using existing alternatives =
to your proposal, i.e., DIY local structs with destructors, or &quot;misusi=
ng&quot; unique_ptr/shared_ptr for that purpose, in contrast to scoped_func=
tion and scoped_resource.
<br></blockquote><div>=A0</div></div><div>Okay, I can definitely consider t=
hat.=A0 Anyone concur? <br></div></blockquote><div><br></div><div>I do, and=
 I feel Peter was not trying to bringing up the previous noise again, but o=
nly, at the end,<br>
to make a point on what should be the focus. <br></div><div>=A0</div><block=
quote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1=
px solid rgb(204,204,204);padding-left:1ex"><div></div><div class=3D"im"><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">

<br>Also providing the no-delete value is not very convincing. What if all =
values less than zero are &quot;no-delete&quot;, or 7, 23 and 42? It compli=
cates the class and API and doesn&#39;t serve a general purpose. Usually a =
predicate is used in other cases to provide a hook for bool checks.
<br>
<br></blockquote></div><div>I disagree with that 100%.=A0 In most cases res=
ources -- real resources like file handles or descriptors, etc. are allocat=
ed and have either a 0 / nullptr or a -1 value on failure=A0 Making the no-=
delete value simple saves a lot of duplicate code.<br>
</div></blockquote><div><br></div><div>Windows <a href=3D"http://msdn.micro=
soft.com/en-us/library/windows/desktop/ms687025%28v=3Dvs.85%29.aspx">WaitFo=
rMultipleObjects</a> is an example of API that, may not completely fit scop=
ed_resource scenery,<br>
but may give an idea of the problem. I too, have found that the current sta=
te fits a scenery that&#39;s not general<br>enough, but may cover most case=
s in the wild... maybe, I can&#39;t be sure about that.<br></div><div>=A0</=
div>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div>=A0<br></div><div cl=
ass=3D"im"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Just my CHF0.02 from a quick scan.
<br>
<br>Peter.
<br>
<br></blockquote></div><div>Thank you for your feedback.<br>Where is everyo=
ne else lately?=A0 Is this the week that the committee is in meetings in Br=
istol?<span class=3D""><font color=3D"#888888"><br>-Andrew Sandoval<br></fo=
nt></span></div>
</blockquote><div><br></div><div>By the way, I&#39;d like to have the newer=
 reference implementations available in source code form (on github for exa=
mple)...<br><br></div><div>Regards,<br></div><div>Francisco Lopes<br></div>
</div></div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />

--001a11c20364c9b7df04f1204922--

.
