220 33129 <CADvuK0LWcmzL5ofmFEB8-eYdwbhvOjNizjoEMFqGGCH0FzSztg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "Arthur O'Dwyer" <arthur.j.odwyer@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: std::optional - support for sentinel values
Date: Wed, 5 Jul 2017 14:47:25 -0700
Lines: 148
Approved: news@gmane.org
Message-ID: <CADvuK0LWcmzL5ofmFEB8-eYdwbhvOjNizjoEMFqGGCH0FzSztg@mail.gmail.com>
References: <6e23864f-827a-4bdb-89de-a60d8f5be993@isocpp.org>
 <c44c5d09-9124-488f-aa92-f9ab59797268@isocpp.org> <CANh8DEkc-u4-60q121uG7moPVHBuAcQJTjpM2Bo9kXx=xn4KYQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="089e08221614266ea9055398f228"
X-Trace: blaine.gmane.org 1499291254 29874 195.159.176.226 (5 Jul 2017 21:47:34 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 5 Jul 2017 21:47:34 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLZJYWNDQIO7PHVZICRUBCQR3YN6@isocpp.org Wed Jul 05 23:47:28 2017
Return-path: <std-proposals+bncBDLZJYWNDQIO7PHVZICRUBCQR3YN6@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f72.google.com ([209.85.215.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDLZJYWNDQIO7PHVZICRUBCQR3YN6@isocpp.org>)
	id 1dSs8p-0007E6-0Q
	for gclcip-std-proposals@m.gmane.org; Wed, 05 Jul 2017 23:47:23 +0200
Original-Received: by mail-lf0-f72.google.com with SMTP id k82sf337370lfg.13
        for <gclcip-std-proposals@m.gmane.org>; Wed, 05 Jul 2017 14:47:28 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1499291248; cv=pass;
        d=google.com; s=arc-20160816;
        b=RGwdFk3pg4tCbyRjXeSDH5YJvRvhjwlEj6mMBdqdFGR84mV4Bn4iVoOiMOpVYQF9YE
         8VPXHdpsbiGJKl3h6Yy1yQRXVVRqw7mBpLrmN6a+tqacNwiapGaYeQ53eHdQEn4/l6fQ
         v/5gspGVrTIeCgKAyr0Ci5X7/imZt1+Uujq+S1Hr6r0YUTP/9Z6njWD2Vw76BQL3dteu
         3QiOTPsnywrcf+JH5ziLtmjk/VKi2orfI99eLxtuyiEebgQ8yAdi3cA0tlUmS9syLT+j
         ZT/RDBOr2yK4eW7ef9YIk+u0y0vLEuMbT2T4hPk8FvZtsU6Zl9CQfO9X4aRQ7awuDqad
         tE7w==
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:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=mYKViEMjBc1H3c9+9p9Dheto0Gm8fc3jgdv1BHAwJeY=;
        b=DEskyan2f5R+t9JKEH6wbHTWz8b8qQtRv21d1/qZbEnf3OHsAumhU8TLkqjc5kXjDL
         6QTYv2HhdmbQp/cotsZlb3AcQz6XZTU/SFw0Ls+mXtz4p8EQG6nyD/1uWhmuxy2deUGS
         WrD+wPcwio3PP5BrFkEkq989R1Md/kLnYiiMVtzJq7Llzjpx+SaFeXFZqN4n6RAURfyQ
         1NnAc4oAonVQ7rFkNWvIORiqyw/PkYhv6PBHd+daBtV6jHYdw9JisaOlXmxa2ZH8JawT
         decicp3Q+J0S1ylNo3it+2PVniG5zG6EMBVNHbCYaqrCMWblKs7Der+b3knK0dPGahys
         spzA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=SjzrWtrV;
       spf=pass (google.com: domain of arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c0c::233 as permitted sender) smtp.mailfrom=arthur.j.odwyer@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
         :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=mYKViEMjBc1H3c9+9p9Dheto0Gm8fc3jgdv1BHAwJeY=;
        b=We+PmHVjinMIDsjzM5xhlA9GbSVvIerkNn0F1PFkvnrsa6a0OIQI8OGaKYIr0YG3c7
         nlvoNZ5PND8UZuSWOTXk6u7iW/gKnY+YPBn9bqe2Kup3R/ysW4tbj696H6pumLm5DFx+
         3H+ajwDW8bPzP5Dg9LvfZh0mN9j4NsAraePKpZ4iC8lWmWcU+mOnYix6/uIRrhsSRDj9
         A5HgMVwVn7GMntJLxY2dDt3crd9+vwkzYODdMqU8ANvJ3ZcdVxncYXUGkT1tUjBpeco8
         k7RJC4v60NCXvG4oWOSLZOPWCYlltd6V7fTNfHGYNys57S1et0XRntHdgdjk5KLoBVRj
         HQsA==
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: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=mYKViEMjBc1H3c9+9p9Dheto0Gm8fc3jgdv1BHAwJeY=;
        b=peTIv2hb2SbHWNYVNqMI8IgzrOI4rkUg+GStSd6RlyFCIms8CcMlGIb4OgLksdv0Hi
         efiBjyMLW2BEoe2DpA2koPcYrZyZM2c+y4gbEmPq/FKFCmwF388Fhv3bEhN3clamEkEN
         KidANqDw8Yor+FrjtWDHOEkgWDYq6XEIZjXfYAYI6qjjVsmcSm6KHc1qAtmqyeIYXn8K
         yz8aYv6X3c4LvrEVttMAT0PLgJ7stl4Xwc/J+ypvPyaJ/eDhlD2RImrXXt2ZPOui/ttc
         01x2H1U6TGmgOv2CCLlaHQ0h6ZzUnsxXuT413Dr/ppCHNfCQ9euEObjTpCpMfguoBT0E
         GLJw==
X-Gm-Message-State: AIVw113LB4Q6Xl4zZi8sVa3kSPkUDgGLAUK9JYRMWUe3q3mLo93O/fVf
	QiFaWNgrh0nAwNYo
X-Received: by 10.46.88.78 with SMTP id x14mr50135ljd.19.1499291248725;
        Wed, 05 Jul 2017 14:47:28 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.142.67 with SMTP id q64ls3815687wmd.2.canary-gmail; Wed, 05
 Jul 2017 14:47:26 -0700 (PDT)
X-Received: by 10.223.136.178 with SMTP id f47mr44435458wrf.117.1499291246885;
        Wed, 05 Jul 2017 14:47:26 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1499291246; cv=none;
        d=google.com; s=arc-20160816;
        b=zv2G25KRQC0aCTfUNAoTnbfM+PmLDBz26tfPKICEvbjZiaubNTezf0dRCE7NLhNrux
         mqqqSGnE2jl7T2OdpA85QYl/5JhCu7RjD8Odp246xrgF2I06FcABeQp1mRVIzSJWZ8vk
         5fcLdbSLt6U5vi1W+AgEXwVpba6yTUNWqa1nqWRXEZrN3X2QUxpXK6y2nY585u7Lseg+
         h6e8XhMzTssotASFCNcwkP+bTm8KQ79XHOgvy4hWGPrX1P1FmE0oBg2S8jDCPkl/z9ru
         s7FuFG5v9xbVxeGcRd+Z5PUzilhJtAgAK+BuEzD2rYS75HztlpEgc8qWLv6RADlCR4a7
         KC7w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=mTzNWnp7INb9t2zG8K+Q9DrT+XiUIUyaNHMGlecd9LU=;
        b=L5/RJ2pGrd4NAEroDwxw58+G0ZVWzXXycQaO0iZ28eUxw9sO0/DgIbui+sv5/laaSN
         sHyarGbd3C/vq+vHeyjHzTkt52/7TIB8e+ceivegoI++13BfYcXK3pgoDMAPZcG+u455
         Id76QqkopQLRGe9uSomc5xyJ1o681Znoxt+63ZOLwaKLE4+TH66dfpGx5ho+k4Lb/pVP
         qQsZ4WkipoHlVDHJ/noP0F+0p6XXFqpwwigNM7B0dyHcveTzm7GsQ58i9CIc5bUFqayO
         UIcn0F9bGw75ZrIOltl4YYw88rwmygP/c0yff6u3khye8SrApnmm+JNRMU7/tdvoHw1o
         3FjQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=SjzrWtrV;
       spf=pass (google.com: domain of arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c0c::233 as permitted sender) smtp.mailfrom=arthur.j.odwyer@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com. [2a00:1450:400c:c0c::233])
        by mx.google.com with ESMTPS id y130si17452831wmd.197.2017.07.05.14.47.26
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 05 Jul 2017 14:47:26 -0700 (PDT)
Received-SPF: pass (google.com: domain of arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c0c::233 as permitted sender) client-ip=2a00:1450:400c:c0c::233;
Original-Received: by mail-wr0-x233.google.com with SMTP id c11so2626479wrc.3
        for <std-proposals@isocpp.org>; Wed, 05 Jul 2017 14:47:26 -0700 (PDT)
X-Received: by 10.80.224.9 with SMTP id e9mr13637928edl.21.1499291246290; Wed,
 05 Jul 2017 14:47:26 -0700 (PDT)
Original-Received: by 10.80.173.235 with HTTP; Wed, 5 Jul 2017 14:47:25 -0700 (PDT)
In-Reply-To: <CANh8DEkc-u4-60q121uG7moPVHBuAcQJTjpM2Bo9kXx=xn4KYQ@mail.gmail.com>
X-Original-Sender: arthur.j.odwyer@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.b=SjzrWtrV;       spf=pass (google.com: domain of
 arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c0c::233 as permitted
 sender) smtp.mailfrom=arthur.j.odwyer@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:33129
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33129>

--089e08221614266ea9055398f228
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 5, 2017 at 7:24 AM, Matt Calabrese wrote:

> On Thu, Jun 29, 2017 at 7:05 PM, Arthur O'Dwyer <arthur.j.odwyer@gmail.co=
m
> > wrote:
>
>> The other extension, orthogonal to first one, is to allow value to be
>>> stored using alternate representation. As an example, reference type ca=
n be
>>> stored as a pointer and simply presented as reference. This will also a=
llow
>>> to have cheap and relatively easy support for storing references in
>>> std::optional, without need of completely separate type specialization.
>>>
>> This is optional<reference_wrapper<T>>.
>> As for why optional<T&> is a terrible, horrible, no-good, very bad idea,
>> please see Matt Calabrese's talk
>> <https://www.youtube.com/watch?v=3DhKIYbf1fsLw> from C++Now.
>>
>
> Erm, that's not what I said in my talk. In fact, quite the opposite. I
> advocate support for optional<T&>
>

Huh!  Well, you fooled me.  What I took away from your talk was mostly the
many examples of why value semantics and regular types are a good thing,
and the subtlety of what it really means to be a "regular" type (for
example, that copying ought to produce an identical, substitutable
duplicate of the original, which implies that you can't be "regular"
without supporting operator=3D=3D).  I also remember the examples of how to
mess things up by injecting "assign-through" types into generic
value-semantic contexts, e.g.

https://wandbox.org/permlink/gmmqCF4d1eSvutZC

int main() {
    int i=3D3, j=3D2, k=3D1;
    using assign_through =3D std::tuple<int&>;
    std::vector<assign_through> v =3D { {i}, {j}, {k} };
    std::sort(v.begin(), v.end());
    printf("%d %d %d\n", i, j, k);  // "3 3 3"
}

I thought you were holding up assign_through as a "bad", "irregular" type,
not as a model.

I also recall (more hazily) discussion of the sins of vector<bool>,
although that might have been a different talk.

Anyway, it sounds like I've misrepresented Matt's opinion. Let me backtrack
and just say that *I personally* wouldn't support the addition of a type to
the library which was (A) irregular and (B) spelled as if it were a
specialization of an existing type that *is* regular.

=E2=80=93Arthur

--=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/CADvuK0LWcmzL5ofmFEB8-eYdwbhvOjNizjoEMFqGGCH0FzS=
ztg%40mail.gmail.com.

--089e08221614266ea9055398f228
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wed, Jul 5, 2017 at 7:24 AM, Matt Calabrese<span dir=3D=
"ltr">=C2=A0</span>wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail=
_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style=
:solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra"><div c=
lass=3D"gmail_quote">On Thu, Jun 29, 2017 at 7:05 PM, Arthur O&#39;Dwyer <s=
pan dir=3D"ltr">&lt;<a href=3D"mailto:arthur.j.odwyer@gmail.com" target=3D"=
_blank">arthur.j.odwyer@gmail.com</a>&gt;</span> wrote:<br><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;b=
order-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"=
><div dir=3D"ltr"><span><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);b=
order-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><p>The other exte=
nsion, orthogonal to first one, is to allow value to be stored using altern=
ate representation. As an example, reference type can be stored as a pointe=
r and simply presented as reference. This will also allow to have cheap and=
 relatively easy support for storing references in std::optional, without n=
eed of completely separate type specialization.</p></div></blockquote></spa=
n><span class=3D"gmail-"><div>This is optional&lt;reference_wrapper&lt;T&gt=
;&gt;<wbr>.</div><div>As for why optional&lt;T&amp;&gt; is a terrible, horr=
ible, no-good, very bad idea, please see <a href=3D"https://www.youtube.com=
/watch?v=3DhKIYbf1fsLw" target=3D"_blank">Matt Calabrese&#39;s talk</a> fro=
m C++Now.</div></span></div></blockquote><div><br></div><div>Erm, that&#39;=
s not what I said in my talk. In fact, quite the opposite. I advocate suppo=
rt for optional&lt;T&amp;&gt;=C2=A0</div></div></div></div></blockquote><di=
v><br></div><div>Huh!=C2=A0 Well, you fooled me.=C2=A0 What I took away fro=
m your talk was mostly the many examples of why value semantics and regular=
 types are a good thing, and the subtlety of what it really means to be a &=
quot;regular&quot; type (for example, that copying ought to produce an iden=
tical, substitutable duplicate of the original, which implies that you can&=
#39;t be &quot;regular&quot; without supporting operator=3D=3D).=C2=A0 I al=
so remember the examples of how to mess things up by injecting &quot;assign=
-through&quot; types into generic value-semantic contexts, e.g.</div><div><=
br></div><div><a href=3D"https://wandbox.org/permlink/gmmqCF4d1eSvutZC">htt=
ps://wandbox.org/permlink/gmmqCF4d1eSvutZC<br></a></div><div><div><br></div=
><div><font face=3D"monospace, monospace">int main() {</font></div><div><fo=
nt face=3D"monospace, monospace">=C2=A0 =C2=A0 int i=3D3, j=3D2, k=3D1;</fo=
nt></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 using assig=
n_through =3D std::tuple&lt;int&amp;&gt;;</font></div><div><font face=3D"mo=
nospace, monospace">=C2=A0 =C2=A0 std::vector&lt;assign_through&gt; v =3D {=
 {i}, {j}, {k} };</font></div><div><font face=3D"monospace, monospace">=C2=
=A0 =C2=A0 std::sort(v.begin(), v.end());</font></div><div><font face=3D"mo=
nospace, monospace">=C2=A0 =C2=A0 printf(&quot;%d %d %d\n&quot;, i, j, k); =
=C2=A0// &quot;3 3 3&quot;</font></div><div><font face=3D"monospace, monosp=
ace">}</font></div></div><div><br></div><div>I thought you were holding up=
=C2=A0<font face=3D"monospace, monospace">assign_through</font>=C2=A0as a &=
quot;bad&quot;, &quot;irregular&quot; type, not as a model.</div><div><br><=
/div><div>I also recall (more hazily) discussion of the sins of <font face=
=3D"monospace, monospace">vector&lt;bool&gt;</font>, although that might ha=
ve been a different talk.</div><div><br></div><div>Anyway, it sounds like I=
&#39;ve misrepresented Matt&#39;s opinion. Let me backtrack and just say th=
at <i>I personally</i> wouldn&#39;t support the addition of a type to the l=
ibrary which was (A) irregular and (B) spelled as if it were a specializati=
on of an existing type that <i>is</i>=C2=A0regular.</div><div><br></div><di=
v>=E2=80=93Arthur</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/CADvuK0LWcmzL5ofmFEB8-eYdwbhvOjNizjoE=
MFqGGCH0FzSztg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0LWcmzL5ofm=
FEB8-eYdwbhvOjNizjoEMFqGGCH0FzSztg%40mail.gmail.com</a>.<br />

--089e08221614266ea9055398f228--

.
