220 32339 <6bfa8a30-a2c4-46d5-8ac2-c0353408a041@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: =?UTF-8?B?UmU6IFtzdGQtcHJvcG9zYWxzXSBSZTogQWRkaW5nIHRoZSBLZXl3b3JkIOKAnGludGVyZg==?=
	=?UTF-8?B?YWNl4oCdIGluIEMrKw==?=
Date: Mon, 8 May 2017 13:44:58 -0700 (PDT)
Lines: 143
Approved: news@gmane.org
Message-ID: <6bfa8a30-a2c4-46d5-8ac2-c0353408a041@isocpp.org>
References: <c8742174-fef0-44a9-988d-2c8aebba9243@isocpp.org>
 <CACL3gUXPSVdsT0Z77igxGVtHU9ALGPcN=7hwKKKfBmt8eQmXtA@mail.gmail.com>
 <9ee212eb-4037-40c4-94c3-57a9a170a4c3@isocpp.org> <1765502.4y06pMOS3s@tjmaciei-mobl1>
 <e8fb03f4-8c94-46c2-a612-acab81117998@isocpp.org>
 <CAOHCbiswurpbE6tG3igWTsFfpJ=LAeT9PoTUZBNsrnMOhEwSxQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_4619_1861128834.1494276299009"
X-Trace: blaine.gmane.org 1494276303 9931 195.159.176.226 (8 May 2017 20:45:03 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 8 May 2017 20:45:03 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBS5RYPEAKGQE7EXML7I@isocpp.org Mon May 08 22:44:59 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBS5RYPEAKGQE7EXML7I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qt0-f197.google.com ([209.85.216.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBS5RYPEAKGQE7EXML7I@isocpp.org>)
	id 1d7pWZ-0002NW-U2
	for gclcip-std-proposals@m.gmane.org; Mon, 08 May 2017 22:44:56 +0200
Original-Received: by mail-qt0-f197.google.com with SMTP id n4sf33270418qte.3
        for <gclcip-std-proposals@m.gmane.org>; Mon, 08 May 2017 13:45:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=Hxxkx2WdpPHhutbUQwmRKEmpbeJCSW/8657UHAE6a6Y=;
        b=m++V0ge4VSlVURNUPXIUBilBJVIhLRM3j27ss98JbcARg9WXn1i3i/HHFPrj4IJJNa
         mpilhwLX+TuC0KhPvYg5hOzTtSxEbKhTD/Lqez4qqHY23S28+7MpTlLQK7/iVALri6Rf
         6QyK4GcdBo+K66VGyOVavTSc7qU24MWROdzN7ra48fpW3QBEoBj3Gk/NN+EvtG0CCHg3
         1HG98g46DypJZ1cBqbahE5D47OZHYa+U02Jkx/0gXSKgK24uQDk2WSmstqf+ssM64wwX
         ONCcnuX1fFC2LZ1n03k7VIhr4o27iRV/hMs4hV0NT0qwdj25+kKUjJJsIJZuagbjkNoq
         1Huw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=Hxxkx2WdpPHhutbUQwmRKEmpbeJCSW/8657UHAE6a6Y=;
        b=h7C1+yZsgBn3pvVnFkggkKc9o6J/u8rK5GaWnKy3HKwAuVdQCVHGk9i3UFdCVaRQws
         fQrax3o/E6vuX+T9bH6910l/kCk0YPBBCQLf12vlnHX7rDi/caoDdHNzUaps4s5oeUVf
         0bOUzl7W42fHXx5M33focOunaA6v9Lwl+5ssO6/liiOe9lz8jnbEPSuBvfWlQuoP6DA2
         Pcn2ePLB/iiA+s24GdsxURaracoD/I3etertP8Wef7QVTA2KoRvS40hH2OHsXuZtjM6+
         8xfe8XSn+Xm9bOwaKMwo2+vZRgfFmattw7ljAZ23mpasaOuJbdK5AX5xhKu0KG6ck7EZ
         vGEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=Hxxkx2WdpPHhutbUQwmRKEmpbeJCSW/8657UHAE6a6Y=;
        b=AA37kW3p+3Lsvxna/sp5VfocOjP2JfqoVeQv5e+7AsyTX4HhiB1uUSCp1DlvrXP5fR
         A8A9hYiZrwzl5w5izzOWvHYv1RC64Ab2pn8DJ8zXvRMKnNpImm2G/xjTDvCkec0TRLeL
         8WF7kmQiCPI8bwS6gP9h2ZugLztc7EnRL/DqVss5RI8v3yFa+0LwyVN5SttSlCjm42m0
         Z/OvJS9Y11blosdsfMG5rrEGzBxKdh/drQhpHEIffdMUuuTqGWsKokmOt7zYPGCZOOry
         DPNPdSAwwc9PoHJqfhl8hn7COhuICZcdQb6dgJ3MtNDwy6aumJX84pGFnbJl8zFU62bH
         ioAw==
X-Gm-Message-State: AN3rC/6SSXzvaTgwWHc8FnH3nkIUvGMx8P7VngXcx+92MwwtAPnVjbNJ
	9bqgjs51ue7wQw==
X-Received: by 10.200.33.215 with SMTP id 23mr28887571qtz.29.1494276300503;
        Mon, 08 May 2017 13:45:00 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.89.238 with SMTP id u46ls10060546otg.2.gmail; Mon, 08 May
 2017 13:44:59 -0700 (PDT)
X-Received: by 10.157.55.133 with SMTP id x5mr822746otb.10.1494276299559;
        Mon, 08 May 2017 13:44:59 -0700 (PDT)
In-Reply-To: <CAOHCbiswurpbE6tG3igWTsFfpJ=LAeT9PoTUZBNsrnMOhEwSxQ@mail.gmail.com>
X-Original-Sender: jmckesson@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:32339
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32339>

------=_Part_4619_1861128834.1494276299009
Content-Type: multipart/alternative; 
	boundary="----=_Part_4620_753737676.1494276299009"

------=_Part_4620_753737676.1494276299009
Content-Type: text/plain; charset=UTF-8

On Monday, May 8, 2017 at 4:11:38 PM UTC-4, Tony V E wrote:
>
> On Mon, May 8, 2017 at 11:16 AM, Nicol Bolas <jmck...@gmail.com 
> <javascript:>> wrote:
>
>> On Monday, May 8, 2017 at 10:54:13 AM UTC-4, Thiago Macieira wrote:
>>>
>>> On Monday, 8 May 2017 00:30:58 PDT Mingxin Wang wrote: 
>>> > Unlike the "*Concespts*" that work at compile time, the 
>>> > "*Interfaces*" work at runtime mostly. In essence, it is not only 
>>> > a syntactic sugar, but a style of implementation for *polymorphism*: 
>>> > virtual functions are only generated when required at runtime 
>>>
>>> "virtual functions generated at runtime" needs A LOT of explanation. 
>>> Please 
>>> explain how the compiler would implement such a thing. 
>>>
>>> i also recommend finding another name for your feature. "interface" is a 
>>> widely 
>>> known term and means something else: it means a base class with virtuals 
>>> that 
>>> need to be overridden.
>>>
>>
>> I think the idea that he's trying to get across is the following.
>>
>> An `interface` is a class which is implicitly convertible from any type 
>> which matches some concept. The implicit conversion effectively works by 
>> storing a type-erased pointer/reference to the object it is converted from.
>>
>
>
> Yep, I think we are talking about automatic type-erasure here.
>
> Sean Parent has done a lot of work with type-erasure and polymorphic 
> values types based on "concepts" (pre Concepts concepts).
>
> I wonder if Concepts + reflection might allow someone to write:
>
> Foo foo; // foo happens to model Concept
> std::erased<Concept> efoo = foo;
> func(efoo);  // Not a templatized function
>
> Tony
>

That would require lots of things that don't exist at present:

1: Reflection to be able to introspect concepts, being able to iterate over 
their constituent expressions.

2: Reflection would need to be able to *generate* code. Otherwise, 
`std::erased` wouldn't be able to generate non-member functions to handle 
non-members of the `Concept`.

3: Concepts would have to be able to be passed as template parameters.

-- 
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/6bfa8a30-a2c4-46d5-8ac2-c0353408a041%40isocpp.org.

------=_Part_4620_753737676.1494276299009
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Monday, May 8, 2017 at 4:11:38 PM UTC-4, Tony V E wrote=
:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bo=
rder-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div cl=
ass=3D"gmail_quote">On Mon, May 8, 2017 at 11:16 AM, Nicol Bolas <span dir=
=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailt=
o=3D"LK3lovSECAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascr=
ipt:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return=
 true;">jmck...@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex"><div dir=3D"ltr"><span>On Monday, May 8, 2017 at 10:54:13 AM UTC-4, =
Thiago Macieira wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;m=
argin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">On Monday, 8 =
May 2017 00:30:58 PDT Mingxin Wang wrote:
<br>&gt; Unlike the &quot;*Concespts*&quot; that work at compile time, the
<br>&gt; &quot;*Interfaces*&quot; work at runtime mostly. In essence, it is=
 not only
<br>&gt; a syntactic sugar, but a style of implementation for *polymorphism=
*:
<br>&gt; virtual functions are only generated when required at runtime
<br>
<br>&quot;virtual functions generated at runtime&quot; needs A LOT of expla=
nation. Please=20
<br>explain how the compiler would implement such a thing.
<br>
<br>i also recommend finding another name for your feature. &quot;interface=
&quot; is a widely=20
<br>known term and means something else: it means a base class with virtual=
s that=20
<br>need to be overridden.<br></blockquote></span><div><br>I think the idea=
 that he&#39;s trying to get across is the following.<br><br>An `interface`=
 is a class which is implicitly convertible from any type which matches som=
e concept. The implicit conversion effectively works by storing a type-eras=
ed pointer/reference to the object it is converted from.<br></div></div></b=
lockquote><div><br><br></div><div>Yep, I think we are talking about automat=
ic type-erasure here.<br><br></div><div>Sean Parent has done a lot of work =
with type-erasure and polymorphic values types based on &quot;concepts&quot=
; (pre Concepts concepts).<br><br></div><div>I wonder if Concepts + reflect=
ion might allow someone to write:<br><br></div><div>Foo foo; // foo happens=
 to model Concept<br></div><div>std::erased&lt;Concept&gt; efoo =3D foo;<br=
></div><div>func(efoo);=C2=A0 // Not a templatized function<br></div><div><=
br></div><div>Tony<br></div></div></div></div></blockquote><div><br>That wo=
uld require lots of things that don&#39;t exist at present:<br><br>1: Refle=
ction to be able to introspect concepts, being able to iterate over their c=
onstituent expressions.<br><br>2: Reflection would need to be able to <i>ge=
nerate</i> code. Otherwise, `std::erased` wouldn&#39;t be able to generate =
non-member functions to handle non-members of the `Concept`.<br><br>3: Conc=
epts would have to be able to be passed as template parameters.<br></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/6bfa8a30-a2c4-46d5-8ac2-c0353408a041%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6bfa8a30-a2c4-46d5-8ac2-c0353408a041=
%40isocpp.org</a>.<br />

------=_Part_4620_753737676.1494276299009--

------=_Part_4619_1861128834.1494276299009--

.
