220 35044 <CAHSYqdadJQEwbHvKDV7m9qtgmMkV+Asw=Na0eEo9C=fjRFHYSA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Hyman Rosen <hyman.rosen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: =?UTF-8?Q?Re=3A_=5Bstd=2Dproposals=5D_Re=3A_std=3A=3Asink=3CT=3E_=E2=80=93_a_better_so?=
	=?UTF-8?Q?lution_to_the_=22nightmare_of_move_semantics=22_=28a=2Ek=2Ea_overload_?=
	=?UTF-8?Q?proliferation=29?=
Date: Fri, 20 Oct 2017 11:34:47 -0400
Lines: 101
Approved: news@gmane.org
Message-ID: <CAHSYqdadJQEwbHvKDV7m9qtgmMkV+Asw=Na0eEo9C=fjRFHYSA@mail.gmail.com>
References: <deaca0b0-1db5-418a-a981-57f3b222eae4@isocpp.org>
 <271bf2c1-854f-4f21-9593-f405f7cd3e8a@isocpp.org> <e5ceeb61-94d0-4135-8ae5-b648c5da12ec@isocpp.org>
 <ee5c23a6-45c2-4310-8730-21937d43bb00@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a1140a828ba42a5055bfc375c"
X-Trace: blaine.gmane.org 1508513708 12432 195.159.176.226 (20 Oct 2017 15:35:08 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 20 Oct 2017 15:35:08 +0000 (UTC)
Cc: joseph.thomson@gmail.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDKJJPVBQMKRBLNPVDHQKGQEDPHBVAQ@isocpp.org Fri Oct 20 17:35:03 2017
Return-path: <std-proposals+bncBDKJJPVBQMKRBLNPVDHQKGQEDPHBVAQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f70.google.com ([74.125.82.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDKJJPVBQMKRBLNPVDHQKGQEDPHBVAQ@isocpp.org>)
	id 1e5ZKB-0002hp-20
	for gclcip-std-proposals@m.gmane.org; Fri, 20 Oct 2017 17:35:03 +0200
Original-Received: by mail-wm0-f70.google.com with SMTP id k4sf5040019wmc.20
        for <gclcip-std-proposals@m.gmane.org>; Fri, 20 Oct 2017 08:35:10 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1508513710; cv=pass;
        d=google.com; s=arc-20160816;
        b=csrFS5j6ktmTQkHOkCa41YBJ3QYvrryHpz9f+Ja+FGXbyJVFe1ZmQAmu5lT3VsNQa1
         AovJBVxpYYd+YkKmzKZf8zj3MvbVpqCcKHS530VSiy0jIop27wQtOk1XZOsUY/rZWqqJ
         8zGhByrj0igLk+ymvNcRyDCxC/lW+l24/Pz4W8Tyy0sS2c+laerNnra9zIBcsxsMkywz
         FF85qhxOvlrnKg+V9SlrzyukP5/HG8j1xwpIEHfNxBqNgFf3ts9Z9uxhLJaX0BUyhRF1
         6ccHIg3pMpMyw1gWE85P8kDJlFXq0uHqJqkspX+Xf3QmeglmWhIwYnH9PyJwLM4mWaVe
         gSag==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:cc:to:subject:message-id
         :date:from:references:in-reply-to:mime-version
         :arc-authentication-results:arc-message-signature:dkim-signature
         :arc-authentication-results;
        bh=MOfdjR0lGKX5dRQmP1fN1SsdOKBW4LtbP2+qo+mrVhg=;
        b=MusSuL+ntU2xdL9enUSZnG5l51ZNhdQadyOHaaZlJoZt2w/oZ/tGVCt6h8qfNCOR0B
         b/69ceauleRGpq9qtkNFylPs3uT6xr93K1a18Ba+/UQoMaF2AN19VB+UaW2B9bZmCIP8
         hS0TMEQaBX5oeqSvKgwkEukmGfjiLZ2Nc85BlXJ3mXKKXO+/d6oZiKU363pXjb6WQ4NW
         mUTptlkME27IqnrII1D1VwUEtuIo6G4ovvRIdmMdM6MC7OLNwb5cwkEEB5ob7VwV9HAO
         CcWMy7YTaFTo7Q8l7IlBIXBpDtPdKpYCr1H1webnN7gOjimjcZHysgz78mRSR00guXVR
         nYzQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=O2tdR12J;
       spf=pass (google.com: domain of hyman.rosen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hyman.rosen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=MOfdjR0lGKX5dRQmP1fN1SsdOKBW4LtbP2+qo+mrVhg=;
        b=XF+6N3cxpExRyjvpPZkEyAPdIEcjWxYFxfjZzA1SRBd+aYQbtItEBmRcMXxdoJyxUU
         HxQuDSI3QVZxreeSgJdhlmLTho2BEl8zD3AY2MH4Mpa3niVfPmE7vSfzUdB+kS72uu3Z
         mF22MV94YT3LFxB5rM8jTvcQoE8lqa1L2W+mavrub/71FUr8IlQ7mp43fxhKTmvRoJGg
         PxpFms5agcNWg9vSUSTe2vhDNu1slByKMTBVs93Nan1TbuUp2GGsXNVrEhcTCsJsaV2i
         UFbPQae18b4PSVlOYnkpv2QqaZwjUaAM1BDAygSNgU4E9D50VnpRhwdAZYOMbi5psV0C
         WK8g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc: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=MOfdjR0lGKX5dRQmP1fN1SsdOKBW4LtbP2+qo+mrVhg=;
        b=Dz6c8tgjWwu9NHaVXFbR/YgV2JCjRnqW5XaVT6DvYuWkzFjaaorS3PiikgeCsIjjkS
         28RAXYnd5kU2jy/X443dmLCqu9QjMlMhyuYDPpviePXTb71wV9FDpKZDThoevLfHaLan
         qm+7w0578TA02F7JsQaxouBy1L+OJjeOCDq90AOWjaZT6J4+GWYFbgZ4yMFEsX/Kfh2e
         BXn/0MfsXL79IiVIXU7CLAUrkGp6U4l9ivb7GrOZ6IDWbZJo2cykOdwnUdXty/U6w/IS
         6kzzM8EBwhj+TXD/lWxoioHLeF14SDPXPYzbIpYkNoKjoDddQI72EQKNqL1z7tYp3Rj6
         BQxQ==
X-Gm-Message-State: AMCzsaV+KiHvlUEw6ZPs/H1KVfQ5FmKu/MdS48Mb3crM5NPh3Jdzomaj
	HwLyQ02RvsZEN23T9x930+c7IQ==
X-Google-Smtp-Source: ABhQp+ReCyMlNqgsvcTLNF379mXwiDnVybk4GLF/lHdfjJQlPmxTgm3YSoDslRP6xZWTKz6KzN4lcw==
X-Received: by 10.28.131.208 with SMTP id f199mr259317wmd.11.1508513710498;
        Fri, 20 Oct 2017 08:35:10 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.159.4 with SMTP id i4ls362762wme.3.gmail; Fri, 20 Oct 2017
 08:35:09 -0700 (PDT)
X-Received: by 10.28.100.3 with SMTP id y3mr1923141wmb.69.1508513709194;
        Fri, 20 Oct 2017 08:35:09 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1508513709; cv=none;
        d=google.com; s=arc-20160816;
        b=yStmWEOJBdn7+mr5WfnhpNoe6vhywGxpqzKqd4Fi/XnAWK2YLjJhZk+RsepapkoeaM
         9f8STDjogL6Hkvx6Liz6CtrfiA0hM6WHPjYFZFulwKARX3YkFhw57Paf3lfM6BdDUq8F
         D8zJtHC3hzu3yZxYzfDC/8QDv5yOnGxJ36nMSm69jgLMFuLzd1kuIH9sVQ9nkToSWZlJ
         Lcqxsk6wHtx22+U4sFUN9ZuANSb74QDaDga/TPeWi2OFxfltgi4d6yvjCc2L0z47ORH6
         8KCeRs+GxuWlkbNCqoX0Vg+EmsFBLjt92St3XnlbaCFDyr6yDhrID7ZMmtkquGeHjobO
         d/cQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=cc:to:subject:message-id:date:from:references:in-reply-to
         :mime-version:dkim-signature:arc-authentication-results;
        bh=Be5MRrC8fqjvRnWbNTutBFlQ0phbitgx70aqTNm2Xgc=;
        b=JRvhM6xBmYoueVnu239ao85sGNJGonqcBN3v40zLicaTqMZEr488C2fjkCUoz60vbc
         iYRO3tPMRosykjh5Ak9UM5/0zUGMUaTV/3uFULlVfHn3TJ42G5FRWH+pn5L4Qe8F6lKB
         kLUguuWt1emKZPxZ+QtEqtIJfvlaxf1qlqNkQSUiucBDf0chzxAnLVi1Az/rVhAW5cH3
         uooOsGq9l0JgFhFtwEeYR/4fItxef+Mb8U4M7+5HwYz380lt9Xl6lAfetZq0DHuaYmB+
         5qHgzGq36Xan7ss4fvRtyiE4qndnBl63DxvmCa33nahBe6NJDuCmXPk2UKUlTgcsAA8m
         RpFw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=O2tdR12J;
       spf=pass (google.com: domain of hyman.rosen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hyman.rosen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id o8sor367676wmd.4.2017.10.20.08.35.09
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 20 Oct 2017 08:35:09 -0700 (PDT)
Received-SPF: pass (google.com: domain of hyman.rosen@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.28.159.72 with SMTP id i69mr1992821wme.53.1508513708391;
 Fri, 20 Oct 2017 08:35:08 -0700 (PDT)
Original-Received: by 10.28.101.8 with HTTP; Fri, 20 Oct 2017 08:34:47 -0700 (PDT)
In-Reply-To: <ee5c23a6-45c2-4310-8730-21937d43bb00@isocpp.org>
X-Original-Sender: hyman.rosen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=O2tdR12J;       spf=pass
 (google.com: domain of hyman.rosen@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=hyman.rosen@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:35044
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35044>

--001a1140a828ba42a5055bfc375c
Content-Type: text/plain; charset="UTF-8"

On Fri, Oct 20, 2017 at 11:18 AM, Nicol Bolas <jmckesson@gmail.com> wrote:
>
> Which will happen either way if you call any functions after that one
> which can throw exceptions. Or if the function throws exceptions for
> reasons other than the construction of its parameters.
>
....
>
Moving state and the strong exception guarantee are somewhat mutually
> exclusive.
>

I would argue that the initialization of function parameters should not be
part
of the function's contract at all.  The function should say what it does
with its
parameters as given, but failure to initialize the parameters means that the
function is never even called; how can it be expected to guarantee anything?

Unless the function you're calling with std::move(lvalue) as an argument
tells
you otherwise, you should assume that the call expression puts the lvalue in
a moved-from state.

By "tells you otherwise," I mean code something like this:
bool try_foo(Thing &&t);  // return true if t is moved from
bool try_bar(Thing &&t);  // return true if t is moved from
void baz() {
    Thing me;
         if (try_foo(std::move(me))) { /* ... */ }
    else if (try_bar(std::move(me))) { /* ... */ }
    else                             { /* me retains its original contents
*/ }
}

-- 
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/CAHSYqdadJQEwbHvKDV7m9qtgmMkV%2BAsw%3DNa0eEo9C%3DfjRFHYSA%40mail.gmail.com.

--001a1140a828ba42a5055bfc375c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On F=
ri, Oct 20, 2017 at 11:18 AM, Nicol Bolas <span dir=3D"ltr">&lt;<a href=3D"=
mailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>&gt;</=
span> wrote:<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 dir=3D"l=
tr"><div>Which will happen either way if you call any functions after that =
one which can throw exceptions. Or if the function throws exceptions for re=
asons other than the construction of its parameters.=C2=A0</div></div></blo=
ckquote><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 dir=3D"ltr">=
<div>...=C2=A0</div></div></blockquote><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex"><div dir=3D"ltr"><div>Moving state and the strong exception g=
uarantee are somewhat mutually exclusive.</div></div></blockquote><div><br>=
I would argue that the initialization of function parameters should not be =
part<br>of the function&#39;s contract at all.=C2=A0 The function should sa=
y what it does with its<br>parameters as given, but failure to initialize t=
he parameters means that the<br>function is never even called; how can it b=
e expected to guarantee anything?<br><br>Unless the function you&#39;re cal=
ling with std::move(lvalue) as an argument tells<br>you otherwise, you shou=
ld assume that the call expression puts the lvalue in<br>a moved-from state=
..<br><br>By &quot;tells you otherwise,&quot; I mean code something like thi=
s:<br><font face=3D"monospace, monospace">bool try_foo(Thing &amp;&amp;t);=
=C2=A0 // return true if t is moved from</font></div><div><font face=3D"mon=
ospace, monospace">bool try_bar(Thing &amp;&amp;t);=C2=A0=C2=A0</font><span=
 style=3D"font-family:monospace,monospace">// return true if t is moved fro=
m<br>void baz() {</span></div><div><span style=3D"font-family:monospace,mon=
ospace">=C2=A0 =C2=A0 Thing me;</span></div><div><span style=3D"font-family=
:monospace,monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (try_foo(std::mo=
ve(me))) { /* ... */ }<br>=C2=A0 =C2=A0 else if (try_bar(std::move(me))) { =
/* ... */ }<br>=C2=A0 =C2=A0 else=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{ /* me retai=
ns its original contents */ }</span></div><div><span style=3D"font-family:m=
onospace,monospace">}</span></div></div></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/CAHSYqdadJQEwbHvKDV7m9qtgmMkV%2BAsw%3=
DNa0eEo9C%3DfjRFHYSA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdadJQ=
EwbHvKDV7m9qtgmMkV%2BAsw%3DNa0eEo9C%3DfjRFHYSA%40mail.gmail.com</a>.<br />

--001a1140a828ba42a5055bfc375c--

.
