220 20307 <229EBC6B-8CA5-45DF-B4AE-BAD809C27A3B@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Draft proposal - std::recover_cast: undoing type erasure
Date: Sun, 6 Sep 2015 10:17:30 +0800
Lines: 111
Approved: news@gmane.org
Message-ID: <229EBC6B-8CA5-45DF-B4AE-BAD809C27A3B@gmail.com>
References: <7935FD03-ACA3-4D49-90B2-BDD107C2EF0B@gmail.com> <55EB974B.4000004@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_DD73C85C-EE70-440D-87F9-D43F4777FFC6"
X-Trace: ger.gmane.org 1441505872 24322 80.91.229.3 (6 Sep 2015 02:17:52 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 6 Sep 2015 02:17:52 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBQOEV2XQKGQEOUA4TCQ@isocpp.org Sun Sep 06 04:17:42 2015
Return-path: <std-proposals+bncBCW25A7E3QCRBQOEV2XQKGQEOUA4TCQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f199.google.com ([209.85.214.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBQOEV2XQKGQEOUA4TCQ@isocpp.org>)
	id 1ZYPWV-0004vS-4S
	for gclcip-std-proposals@m.gmane.org; Sun, 06 Sep 2015 04:17:39 +0200
Original-Received: by obbhk5 with SMTP id hk5sf101639758obb.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 05 Sep 2015 19:17:38 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:content-type:message-id:mime-version
         :subject:date:references:to:in-reply-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=0InVf1wWiJkvVJSsiLbBytmiYT16uvf9/gZa2fvTX0Y=;
        b=GuZzwzzaPkpXOsNjIWXyA9CP1WPwG8kPtgH2zA6y3PuTc2de9L0UKrIZVAYvjV0M5c
         SCwEqEiAKxK9sRgG8+srW2bEq0ufpE3FLKbKbkoCLPNq88NL4coJsusuVkgb85w9a4Ay
         0Cizxsjui0K8fzEdSWoOYygJt92eGvlj36rxQy7Ds6ioN+R6GADkxGWx3yEAK61P9dgV
         4vimbXTH6CtXwo25GTrNU/alI1Q6MYl0wl2puAdJ2YA1NBFKuTQ0CssDQy/8Mro+3bMO
         f9iVG702VWhT8JIjT/XPbq1QDo9O1K3p+4Q4dUnA/R05/MF8pPeon8K60izIqBTaOSQ2
         zQ7w==
X-Gm-Message-State: ALoCoQn9nyIa8bu3etXh4kUsIDTUXEeuDGPtpcf7nrbCIwJZMTlxlSa/7GoahH1xcAkXPx6Aawa3
X-Received: by 10.107.163.81 with SMTP id m78mr11502276ioe.18.1441505858399;
        Sat, 05 Sep 2015 19:17:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.142.42 with SMTP id rt10ls499701igb.44.gmail; Sat, 05 Sep
 2015 19:17:37 -0700 (PDT)
X-Received: by 10.68.131.33 with SMTP id oj1mr27569722pbb.96.1441505857645;
        Sat, 05 Sep 2015 19:17:37 -0700 (PDT)
Original-Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com. [2607:f8b0:400e:c03::22b])
        by mx.google.com with ESMTPS id da4si12766461pad.91.2015.09.05.19.17.37
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 05 Sep 2015 19:17:37 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c03::22b as permitted sender) client-ip=2607:f8b0:400e:c03::22b;
Original-Received: by padhy16 with SMTP id hy16so58454923pad.1
        for <std-proposals@isocpp.org>; Sat, 05 Sep 2015 19:17:37 -0700 (PDT)
X-Received: by 10.66.144.165 with SMTP id sn5mr28354800pab.122.1441505857332;
        Sat, 05 Sep 2015 19:17:37 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.44.89])
        by smtp.gmail.com with ESMTPSA id dh1sm7201795pbd.49.2015.09.05.19.17.35
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 05 Sep 2015 19:17:36 -0700 (PDT)
In-Reply-To: <55EB974B.4000004@wanadoo.fr>
X-Mailer: Apple Mail (2.2098)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:400e:c03::22b as permitted
 sender) smtp.mailfrom=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=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-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:20307
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/20307>

--Apple-Mail=_DD73C85C-EE70-440D-87F9-D43F4777FFC6
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9309=E2=80=9306, at 9:30 AM, Vicente J. Botet Escriba <vice=
nte.botet@wanadoo.fr> wrote:
>=20
> As Andrey, I don't believe that we need to go too far. I don't see the ne=
ed to require anything on some TypeErase concept.=20
> We just need to allow to overload this function for several types. This d=
oesn't mean that we can not have a common implementation for some types.

The problem is that it=E2=80=99s difficult to implement the common protocol=
.. Besides any_cast, optional::operator*, and get(variant) having different =
specs, there have been implementation bugs and DRs against the handling of =
const and value category. Consider const&& references, for example.

The implementation experience so far shows that it=E2=80=99s a bad idea to =
have each class provide its own overload set.

Separately, most users call standard library functions, including cast func=
tions, as std::dynamic_pointer_cast, not considering ADL overloading =E2=80=
=94 and ADL can be fragile when template arguments bring in overloads from =
various libraries. The common implementation is more usable because std:: i=
s guaranteed to work. I touch on this in the paper, but perhaps should elab=
orate a little.

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_DD73C85C-EE70-440D-87F9-D43F4777FFC6
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9309=
=E2=80=9306, at 9:30 AM, Vicente J. Botet Escriba &lt;<a href=3D"mailto:vic=
ente.botet@wanadoo.fr" class=3D"">vicente.botet@wanadoo.fr</a>&gt; wrote:</=
div><br class=3D"Apple-interchange-newline"><div class=3D""><span style=3D"=
font-family: Helvetica; font-size: large; font-style: normal; font-variant:=
 normal; font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: none; w=
hite-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-wi=
dth: 0px; background-color: rgb(255, 255, 255); float: none; display: inlin=
e !important;" class=3D"">As Andrey, I don't believe that we need to go too=
 far. I don't see the need to require anything on some TypeErase concept.<s=
pan class=3D"Apple-converted-space">&nbsp;</span></span><br style=3D"font-f=
amily: Helvetica; font-style: normal; font-variant: normal; font-weight: no=
rmal; letter-spacing: normal; line-height: normal; orphans: auto; text-alig=
n: start; text-indent: 0px; text-transform: none; white-space: normal; wido=
ws: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""><s=
pan style=3D"font-family: Helvetica; font-size: large; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; line-hei=
ght: normal; orphans: auto; text-align: start; text-indent: 0px; text-trans=
form: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-t=
ext-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; d=
isplay: inline !important;" class=3D"">We just need to allow to overload th=
is function for several types. This doesn't mean that we can not have a com=
mon implementation for some types.</span><br style=3D"font-family: Helvetic=
a; font-style: normal; font-variant: normal; font-weight: normal; letter-sp=
acing: normal; line-height: normal; orphans: auto; text-align: start; text-=
indent: 0px; text-transform: none; white-space: normal; widows: auto; word-=
spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""></div></blockquot=
e></div><br class=3D""><div class=3D"">The problem is that it=E2=80=99s dif=
ficult to implement the common protocol. Besides <font face=3D"Courier" cla=
ss=3D"">any_cast</font>, <font face=3D"Courier" class=3D"">optional::operat=
or*</font>, and <font face=3D"Courier" class=3D"">get(variant)</font> havin=
g different specs, there have been implementation bugs and DRs against the =
handling of <font face=3D"Courier" class=3D"">const</font> and value catego=
ry. Consider <font face=3D"Courier" class=3D"">const&amp;&amp;</font> refer=
ences, for example.</div><div class=3D""><br class=3D""></div><div class=3D=
"">The implementation experience so far shows that it=E2=80=99s a bad idea =
to have each class provide its own overload set.</div><div class=3D""><br c=
lass=3D""></div><div class=3D"">Separately, most users call standard librar=
y functions, including cast functions, as <font face=3D"Courier" class=3D""=
>std::dynamic_pointer_cast</font>, not considering ADL overloading =E2=80=
=94 and ADL can be fragile when template arguments bring in overloads from =
various libraries. The common implementation is more usable because <font f=
ace=3D"Courier" class=3D"">std::</font> is guaranteed to work. I touch on t=
his in the paper, but perhaps should elaborate a little.</div><div class=3D=
""><br class=3D""></div></body></html>

<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 />

--Apple-Mail=_DD73C85C-EE70-440D-87F9-D43F4777FFC6--

.
