220 18781 <CAGg_6+NgVUfb6YTtieNg9tgQM7Agi26-k5sz26SPhXasuv0=kw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Nevin Liber <nevin@eviloverlord.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Compressing std::optional
Date: Thu, 25 Jun 2015 10:34:39 -0500
Lines: 190
Approved: news@gmane.org
Message-ID: <CAGg_6+NgVUfb6YTtieNg9tgQM7Agi26-k5sz26SPhXasuv0=kw@mail.gmail.com>
References: <4359ebfb-5e20-42c1-84a0-16ef6201db33@isocpp.org>
 <CANh-dXnEYdvkPqzcyb34=G8HyY=5_=k_Y5RTE7C1i_SAWbqH7w@mail.gmail.com>
 <CAGg_6+O2-E1avXd54qXw_yNVRc3dCw6ZS=bvE=GpoWWTT9FjuQ@mail.gmail.com> <CAOHCbiuG6xXRZJypZBpESRDs5rmk69bCafcM7zJjVRQ26Xcwkg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c23d9cedfd750519595e39
X-Trace: ger.gmane.org 1435246531 13358 80.91.229.3 (25 Jun 2015 15:35:31 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 25 Jun 2015 15:35:31 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCE35H5S6IDBBN57WCWAKGQEBAJHGTI@isocpp.org Thu Jun 25 17:35:25 2015
Return-path: <std-proposals+bncBCE35H5S6IDBBN57WCWAKGQEBAJHGTI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f72.google.com ([209.85.215.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCE35H5S6IDBBN57WCWAKGQEBAJHGTI@isocpp.org>)
	id 1Z89BT-0001HE-1b
	for gclcip-std-proposals@m.gmane.org; Thu, 25 Jun 2015 17:35:23 +0200
Original-Received: by laka10 with SMTP id a10sf19998868lak.2
        for <gclcip-std-proposals@m.gmane.org>; Thu, 25 Jun 2015 08:35:22 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:content-type: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=cCuJDmnNjeNo4sXG79u/YlAkCiG+g1vVAtOn+rq7nBw=;
        b=QoQA1vMzMRDfSQaN8SARysaBI7It6jSl3EU+uPSc4BK6pEUrquYqK0P4vwxjppK8wb
         X7VyvMWhTBh3TUDL0rK8dYd7nWCSiII89PCzzIjozZqGzuZSlFJqN1rsz4CMk1Mm5AmS
         30DaIXNRnyx/qkNFWeZHRKYHW8TgbODyHcMWBnxJjew+ptDtYVDo4F/CNCwuJcT9hJnO
         E2AZddbDnqs0Wibtm+9Arp81kA+WCiiS7vzTLHf+mh0c9tvo/cvJXaujYwnhPIor+xlF
         QynNvRyR+HRUYvmR3tZviAMnLEFQAkskNlhPUFfYCNBDKMw39n1LP8e+CS6oGpIh2kpU
         waag==
X-Gm-Message-State: ALoCoQk5+cBE5fW2+m5joJL1df95mjSWslvLXZrfvUnT9GXh72hLXEKwzHa3zjknOP7gXnI2LNWy
X-Received: by 10.112.42.236 with SMTP id r12mr40227341lbl.2.1435246522384;
        Thu, 25 Jun 2015 08:35:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.184.164 with SMTP id ev4ls355032wic.16.canary; Thu, 25 Jun
 2015 08:35:19 -0700 (PDT)
X-Received: by 10.180.86.163 with SMTP id q3mr6785958wiz.75.1435246519443;
        Thu, 25 Jun 2015 08:35:19 -0700 (PDT)
Original-Received: from mail-wg0-x22b.google.com (mail-wg0-x22b.google.com. [2a00:1450:400c:c00::22b])
        by mx.google.com with ESMTPS id fr8si9262551wib.3.2015.06.25.08.35.19
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 25 Jun 2015 08:35:19 -0700 (PDT)
Received-SPF: pass (google.com: domain of nliber@gmail.com designates 2a00:1450:400c:c00::22b as permitted sender) client-ip=2a00:1450:400c:c00::22b;
Original-Received: by wgbhy7 with SMTP id hy7so65894630wgb.2
        for <std-proposals@isocpp.org>; Thu, 25 Jun 2015 08:35:19 -0700 (PDT)
X-Received: by 10.180.9.6 with SMTP id v6mr6874518wia.83.1435246518990; Thu,
 25 Jun 2015 08:35:18 -0700 (PDT)
Original-Sender: nliber@gmail.com
Original-Received: by 10.194.16.41 with HTTP; Thu, 25 Jun 2015 08:34:39 -0700 (PDT)
In-Reply-To: <CAOHCbiuG6xXRZJypZBpESRDs5rmk69bCafcM7zJjVRQ26Xcwkg@mail.gmail.com>
X-Original-Sender: nevin@eviloverlord.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of nliber@gmail.com designates 2a00:1450:400c:c00::22b as permitted
 sender) smtp.mail=nliber@gmail.com;       dkim=pass header.i=@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:18781
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18781>

--001a11c23d9cedfd750519595e39
Content-Type: text/plain; charset=UTF-8

On 25 June 2015 at 09:31, Tony V E <tvaneerd@gmail.com> wrote:

> Are you only against it because it might delay optional, or for
> technical/design reasons?
>

Both.

If optional significantly changes, then any user experience we have so far
gets thrown out the window. I'm fine if that happens because of the user
experience, but I'm not fine with that for the purposes of invention.
Especially if optional is a vocabulary type being targeted for C++17.


As for technical considerations:

One of the mental models we used for designing optional was that it is a T
with an extra state.  This customization breaks that model.

We would have to revisit every single line of optional to see if it still
holds true.

For purposes of this, lets assume I want an optional<string> where
string("Geronimo") is the unengaged state.

Let us start with the simplest constructors:

  constexpr optional() noexcept;

  constexpr optional(nullopt_t) noexcept;


They are obviously no longer noexecept(true).  Do we make that
conditionally noexcept?  If so, how?  This customization will be as
complicated as allocators (such as a
noexcept_on_nullopt_t_construction_or_assignment member type derived from
bool_type).

How about assignment?  Take

    optional<T>& operator=(nullopt_t) noexcept;

Besides the noexcept issue, what state is the optional left in when an
exception is thrown?  Beats me.

And those are the simpler things.  We haven't even gotten to the more
controversial stuff, like heterogeneous comparisons and ordering.

And there may language issues.  As proposed:

    template <typename T>
    void set_initialized(T*, bool initialized)

The T* being passed may be a pointer to uninitialized storage and not a T.
Is that legal?

LEWG likes to "time box" discussions (which I strongly disagree with,
because it basically means we aren't giving the author enough feedback to
make useful progress, making it poor use of both the author's time and the
committee's time.  If we don't have the time to adequately discuss things,
why are we soliciting for more stuff?).  Based on how much committee time
has been and will be spent on optional and variant, do you really think we
can get through this kind of proposal in only an hour or two?  I don't.


Now, a significant portion of the complexity goes away if it is a separate
type, because a separate type can just store a T instead of a block of
storage it has to manage, the ordering can be identical to T, etc.
-- 
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

-- 

--- 
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/.

--001a11c23d9cedfd750519595e39
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 2=
5 June 2015 at 09:31, Tony V E <span dir=3D"ltr">&lt;<a href=3D"mailto:tvan=
eerd@gmail.com" target=3D"_blank">tvaneerd@gmail.com</a>&gt;</span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:soli=
d;padding-left:1ex"><div dir=3D"ltr"><div>Are you only against it because i=
t might delay optional, or for technical/design reasons?<br></div></div></b=
lockquote><div><br></div><div>Both.</div><div><br></div><div>If optional si=
gnificantly changes, then any user experience we have so far gets thrown ou=
t the window. I&#39;m fine if that happens because of the user experience, =
but I&#39;m not fine with that for the purposes of invention.=C2=A0 Especia=
lly if optional is a vocabulary type being targeted for C++17.</div><div><b=
r></div><div><br></div><div>As for technical considerations:</div><div><br>=
</div><div>One of the mental models we used for designing optional was that=
 it is a T with an extra state.=C2=A0 This customization breaks that model.=
<br></div><div><br></div><div>We would have to revisit every single line of=
 optional to see if it still holds true.</div><div><br></div><div>For purpo=
ses of this, lets assume I want an optional&lt;string&gt; where string(&quo=
t;Geronimo&quot;) is the unengaged state.</div><div><br></div><div>Let us s=
tart with the simplest constructors:</div><div><br></div><div><pre style=3D=
"margin-left:1em;margin-top:0.5em;margin-bottom:0.5em;color:rgb(0,0,0)"><co=
de style=3D"white-space:inherit">  constexpr optional() noexcept;
</code></pre><pre style=3D"margin-left:1em;margin-top:0.5em;margin-bottom:0=
..5em;color:rgb(0,0,0)"><code style=3D"white-space:inherit">  constexpr opti=
onal(nullopt_t) noexcept;
</code></pre></div><div><br></div><div>They are obviously no longer noexece=
pt(true).=C2=A0 Do we make that conditionally noexcept?=C2=A0 If so, how?=
=C2=A0 This customization will be as complicated as allocators (such as a n=
oexcept_on_nullopt_t_construction_or_assignment member type derived from bo=
ol_type).</div><div><br></div><div>How about assignment?=C2=A0 Take</div><d=
iv><br></div><div><pre style=3D"margin-top:0px;margin-bottom:0px;color:rgb(=
0,0,0)"><code style=3D"white-space:inherit">    optional&lt;T&gt;&amp; oper=
ator=3D(nullopt_t) noexcept;<br></code></pre></div><div><code style=3D"whit=
e-space:inherit"><div style=3D"font-family:arial,sans-serif">Besides the no=
except issue, what state is the optional left in when an exception is throw=
n?=C2=A0 Beats me.</div><div style=3D"font-family:arial,sans-serif"><br></d=
iv><div style=3D"font-family:arial,sans-serif">And those are the simpler th=
ings.=C2=A0 We haven&#39;t even gotten to the more controversial stuff, lik=
e heterogeneous comparisons and ordering.</div><div style=3D"font-family:ar=
ial,sans-serif"><br></div><div style=3D"font-family:arial,sans-serif">And t=
here may language issues.=C2=A0 As proposed:</div><div style=3D"font-family=
:arial,sans-serif"><br></div></code><div style=3D"font-family:arial,sans-se=
rif"><code style=3D"white-space:inherit"><span style=3D"font-family:monospa=
ce;font-size:10.4000005722046px;color:rgb(0,0,0);background-color:rgb(250,2=
50,250)">=C2=A0 =C2=A0 template &lt;typename T&gt;<br>=C2=A0 =C2=A0=C2=A0</=
span><span style=3D"font-family:monospace;font-size:10.4000005722046px;colo=
r:rgb(0,0,136);background-color:rgb(250,250,250)">void</span><span style=3D=
"font-family:monospace;font-size:10.4000005722046px;color:rgb(0,0,0);backgr=
ound-color:rgb(250,250,250)">=C2=A0set_initialized</span><span style=3D"fon=
t-family:monospace;font-size:10.4000005722046px;color:rgb(102,102,0);backgr=
ound-color:rgb(250,250,250)">(</span><span style=3D"font-family:monospace;f=
ont-size:10.4000005722046px;color:rgb(102,102,0);background-color:rgb(250,2=
50,250)"><code><code><code><span style=3D"color:rgb(0,0,0)"><code><span sty=
le=3D"color:rgb(102,102,0)"></span><span style=3D"color:rgb(102,102,0)"><co=
de><span style=3D"color:rgb(0,0,0)">T*,=C2=A0</span></code></span></code></=
span></code></code></code></span></code><span style=3D"font-family:monospac=
e;font-size:10.4000005722046px;color:rgb(102,102,0);background-color:rgb(25=
0,250,250)"><code><code><code><span style=3D"color:rgb(0,0,0)"><code><span =
style=3D"color:rgb(102,102,0)"><code><span style=3D"color:rgb(0,0,0)"><code=
><code><span style=3D"color:rgb(0,0,136)">bool</span></code></code>=C2=A0in=
itialized</span></code></span></code></span></code></code></code></span><sp=
an style=3D"font-family:monospace;font-size:10.4000005722046px;color:rgb(0,=
0,0);background-color:rgb(250,250,250)">)<br></span></div><div style=3D"fon=
t-family:arial,sans-serif"><span style=3D"font-family:monospace;font-size:1=
0.4000005722046px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br><=
/span></div><div style=3D"font-family:arial,sans-serif"><div class=3D"gmail=
_quote">The T* being passed may be a pointer to uninitialized storage and n=
ot a T.=C2=A0 Is that legal?</div><div class=3D"gmail_quote"><br></div></di=
v><div style=3D"font-family:arial,sans-serif">LEWG likes to &quot;time box&=
quot; discussions (which I strongly disagree with, because it basically mea=
ns we aren&#39;t giving the author enough feedback to make useful progress,=
 making it poor use of both the author&#39;s time and the committee&#39;s t=
ime.=C2=A0 If we don&#39;t have the time to adequately discuss things, why =
are we soliciting for more stuff?).=C2=A0 Based on how much committee time =
has been and will be spent on optional and variant, do you really think we =
can get through this kind of proposal in only an hour or two?=C2=A0 I don&#=
39;t.</div></div><div style=3D"font-family:arial,sans-serif"><br></div><div=
 style=3D"font-family:arial,sans-serif"><br></div><div style=3D"font-family=
:arial,sans-serif">Now, a significant portion of the complexity goes away i=
f it is a separate type, because a separate type can just store a T instead=
 of a block of storage it has to manage, the ordering can be identical to T=
, etc.</div></div>-- <br><div class=3D"gmail_signature">=C2=A0Nevin &quot;:=
-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" t=
arget=3D"_blank">nevin@eviloverlord.com</a>&gt;=C2=A0 (847) 691-1404</div>
</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 />

--001a11c23d9cedfd750519595e39--

.
