220 32338 <CAOHCbiswurpbE6tG3igWTsFfpJ=LAeT9PoTUZBNsrnMOhEwSxQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Tony V E <tvaneerd@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: =?UTF-8?B?UmU6IFtzdGQtcHJvcG9zYWxzXSBSZTogQWRkaW5nIHRoZSBLZXl3b3JkIOKAnGludGVyZg==?=
	=?UTF-8?B?YWNl4oCdIGluIEMrKw==?=
Date: Mon, 8 May 2017 16:11:35 -0400
Lines: 190
Approved: news@gmane.org
Message-ID: <CAOHCbiswurpbE6tG3igWTsFfpJ=LAeT9PoTUZBNsrnMOhEwSxQ@mail.gmail.com>
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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=f403045f2ed6a0c634054f08d81f
X-Trace: blaine.gmane.org 1494274297 31023 195.159.176.226 (8 May 2017 20:11:37 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 8 May 2017 20:11:37 +0000 (UTC)
To: Standard Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUZ5QWKNQIPTIODZACRUBHGXK7XI@isocpp.org Mon May 08 22:11:33 2017
Return-path: <std-proposals+bncBCUZ5QWKNQIPTIODZACRUBHGXK7XI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f71.google.com ([74.125.82.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUZ5QWKNQIPTIODZACRUBHGXK7XI@isocpp.org>)
	id 1d7p0H-0007yT-42
	for gclcip-std-proposals@m.gmane.org; Mon, 08 May 2017 22:11:33 +0200
Original-Received: by mail-wm0-f71.google.com with SMTP id u65sf11437639wmu.12
        for <gclcip-std-proposals@m.gmane.org>; Mon, 08 May 2017 13:11:38 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1494274298; cv=pass;
        d=google.com; s=arc-20160816;
        b=qVYs3XNCRlsdQp2eQEO1a0B0oic2cXXWUsTnG6JZ4GdUZ95FeFAfsUTmKF4I7NJumQ
         3ZpxZ2nbccD6K3RGeJLDc6NmVIIaX6RBsnbVbJrncog9GS06y+VuItg+tO3ecleg7I60
         is1H2cChXpKo2a423SZnQrBFzTfPAJn8SH/G3ExMfmkbMjKxxpQKADmGAmKSCxH5t+mT
         Tp/Z49s6um+rB81+yVQAcGvt3ptF5XNL5TE3IpTqZbdC1Eb3nME55r78ZO98g8h5Rpui
         /J/4AVxQ2sxAGmBs8oY3QlO28bwTzFxtt2N8wnD9AwmWbI6Z0xZQmQ0KLH7rnEVosfI4
         LFhw==
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=14OEHPjVQLlMAkKgRt427t9R8IkoRQuWC91i+jCmCYQ=;
        b=uCBsMFv1aCvEbifsRZFH3t0nkPl6U6a13pEpAck+7/o5cv3h6sBG3JwNnJnikpMDZq
         x64pu+ASMliQ1LymCcxjjEr8eHACOY8IkHTGFmMMe3YzLVM940oelQwxe3PjUCOw+IAm
         37Y8gsfqQ3lj58bejx7v1Nz1uelOWBiOUG9fzII0xwC44oSWg+1qYZdIrF3gJKtvdiGm
         EgdIFdGPTlBNDZh4z3zZtYwSXtlr1Fanr7PeIiDL1nszKvl1IrBwb7vSV3nPqoOoBqpB
         QVqu3zqvQoFwXHmYFzlvMvjFqpmjf5TVEGzgiehMr+xYiceQm2qRaoeMqnyq6QhXe1se
         3biw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com;
       spf=pass (google.com: domain of tvaneerd@gmail.com designates 2a00:1450:400c:c0c::229 as permitted sender) smtp.mailfrom=tvaneerd@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:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=14OEHPjVQLlMAkKgRt427t9R8IkoRQuWC91i+jCmCYQ=;
        b=oKSKqC27VWT+aS/joPb0KkLnXFpsOGNNSIBfTLbyiiIL1OWf91+Z/S1XUyyTh6Cm6w
         HXo10lQKzUaum5CnyfW7orVEwEYetPNUgVSjWtFM5OFWIsmjAPmUPYJ7xGQs3drZF60s
         T/T4RzoWZKoO/85Y5nR9RoxiIlCxwhd0aP9MZDssBw6tIsNNzYwWil1+4isFYA0abYLp
         QaSOhcDUBqCU9f4P7G4sxOTNWpvKkCpsxL9MtMazgAVPaCGw0/5z9/0rvVsmVwqzJyxI
         Yh4gb3M8JnKLMlfruGsvkSEtcZSmCrpUXr1cN3ps5JApB8NWxK1e3anTcXvHHn3+8Jnm
         IaAw==
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=14OEHPjVQLlMAkKgRt427t9R8IkoRQuWC91i+jCmCYQ=;
        b=IPDBm0mD4TIP62kbYdUcypO9MU+R6YACGRVhSCpu0ucAPX2B8TNxWaszwfDGtL0mH5
         IwWrz6hd44JsZdvNuLSl5Kwh90MmIKEA2H2sfkS1RkmKaDtjcqisB/wOeB60V+3H7eEk
         SrDMQVT6lKx+xp1o/WwoOvmIfQE64CEWiL1ATW31sBwUqwAtDaXSJqnp3nzkV/YNoRJ4
         uFgaOV51X9gQeJvmcFRqTDslny0wlVhOaqlkQoSl5a4s1m4wqoD4trFv93B/7vYTM5kN
         YijTUqNB3S5YFZISasx5KSew6MsQKh8nkwgpePkLFjcRQuZPIgPqdbZHvsNIF5olkspR
         ED6A==
X-Gm-Message-State: AN3rC/51oNkE32xqzCmgmIn0nvt2GOTAeCCfsJ1C7C3K7drSua6CCeRQ
	iUqo7mRP9OJsWQ==
X-Received: by 10.25.22.19 with SMTP id m19mr6269424lfi.10.1494274298435;
        Mon, 08 May 2017 13:11:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.195.137 with SMTP id t131ls1395949wmf.0.canary-gmail; Mon,
 08 May 2017 13:11:36 -0700 (PDT)
X-Received: by 10.223.147.97 with SMTP id 88mr38588713wro.134.1494274296720;
        Mon, 08 May 2017 13:11:36 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1494274296; cv=none;
        d=google.com; s=arc-20160816;
        b=B14yfv5VF31ZEYxZ2BfuyKLCCRFHSwJhQEnTsjQRV0iCjOqTpkJmDULdU5sqJFH02j
         v2FVOYo+K7k6sctYwYsf6gQm5pFFvnEICvGLUgxXAF4Lpov1IbrD3kQx44TelbLRnyBC
         fGj6XjX6uqoWZ6gCNCaT+FwpZhU1U58xEOaeaP2aqO1wob9IRTwQtf55/aYbPC/B1lw2
         zDLVFZdjQBskH5U0jC13ZAa1ZhqETGGc9uIdPf3gzvBlUHrBDkLiJyL7tBSz1yk/RKQ9
         NRDlNnLDV0+pjYy0XwRqCMVf8giBdzdFgLn66RMscb8BUuYmZX9zL013QfaxbbajQMqC
         KPWw==
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=wdw+tOotXopeYl8zEXKdWhmNoz8NtQfDzcoUtHiSSJ0=;
        b=HPBsPsmGmFn6lmhUe2HSV8xneOHmVa8Q7fsY/6io8lHn/y/sknuRAO7nxjPd221Zgn
         /hmUB5wnY+4gpfVbUl5KtrqD7eOYrQcr0SWpsP5wSvxtjZhoZtb2WKiMP1qHsy7trQ6G
         6rKVBFpkQO0bDQldQZmeGW7LhpeOW2lXofgdO+TpNR0wyMa8urh3EnnSNT6Yv4ua1Bqf
         L5vuNFN7OplOOWYQDR3xlM1WQcWGNBuY9HZxAvXeZxuDt3saWjuOsTJuo2h6sdnc4b4B
         wHVntJpE9zS3Q7sSYo9RqrYn4cysYYxr8/Q2bD8C/8oDrTUCjht90NPXbgUYPoltJoem
         aJuQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com;
       spf=pass (google.com: domain of tvaneerd@gmail.com designates 2a00:1450:400c:c0c::229 as permitted sender) smtp.mailfrom=tvaneerd@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-wr0-x229.google.com (mail-wr0-x229.google.com. [2a00:1450:400c:c0c::229])
        by mx.google.com with ESMTPS id v102si16202463wrb.15.2017.05.08.13.11.36
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 08 May 2017 13:11:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of tvaneerd@gmail.com designates 2a00:1450:400c:c0c::229 as permitted sender) client-ip=2a00:1450:400c:c0c::229;
Original-Received: by mail-wr0-x229.google.com with SMTP id l9so53547560wre.1
        for <std-proposals@isocpp.org>; Mon, 08 May 2017 13:11:36 -0700 (PDT)
X-Received: by 10.223.161.194 with SMTP id v2mr42128951wrv.132.1494274296299;
 Mon, 08 May 2017 13:11:36 -0700 (PDT)
Original-Received: by 10.28.232.24 with HTTP; Mon, 8 May 2017 13:11:35 -0700 (PDT)
In-Reply-To: <e8fb03f4-8c94-46c2-a612-acab81117998@isocpp.org>
X-Original-Sender: tvaneerd@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of tvaneerd@gmail.com
 designates 2a00:1450:400c:c0c::229 as permitted sender) smtp.mailfrom=tvaneerd@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:32338
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32338>

--f403045f2ed6a0c634054f08d81f
Content-Type: text/plain; charset="UTF-8"

On Mon, May 8, 2017 at 11:16 AM, Nicol Bolas <jmckesson@gmail.com> 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


>
> The concept it matches is defined by the set of member functions in the
> `interface`. The `interface` class will automatically generate matching
> member functions which forward calls to the type-erased pointer/reference.
>
> So it's not a "virtual" call in the language sense; it's a virtual call in
> the polymorphic sense.
>
> I like the idea of being able to take a concept and turn it into a type
> that can type-erase any type that matches the concept. This allows you to
> turn a compile-time polymorphism tool into a runtime polymorphism tool. But
> if you want to do it directly through concepts, then this should include
> more than just member functions. The type-erasure/code generation now needs
> to include any operations specified by the concept, including overloaded
> operators, global ADL functions, and the like.
>
> I would also want to see some way of defining copy/move behavior. That is,
> whether the conversion to the "interface" type will create its own object
> (like `any` or `function`) or whether it will just reference an existing
> one, as well as specifying whether the type is move-only or copyable.
>
> --
> 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/e8fb03f4-8c94-46c2-
> a612-acab81117998%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e8fb03f4-8c94-46c2-a612-acab81117998%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>



-- 
Be seeing you,
Tony

-- 
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/CAOHCbiswurpbE6tG3igWTsFfpJ%3DLAeT9PoTUZBNsrnMOhEwSxQ%40mail.gmail.com.

--f403045f2ed6a0c634054f08d81f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Mon, May 8, 2017 at 11:16 AM, Nicol Bolas <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a=
>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 =
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><spa=
n class=3D"">On Monday, May 8, 2017 at 10:54:13 AM UTC-4, Thiago Macieira w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-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>=C2=A0<br></div><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><div><br>The concept it matches is defined by the set=
 of member functions in the `interface`. The `interface` class will automat=
ically generate matching member functions which forward calls to the type-e=
rased pointer/reference.<br><br>So it&#39;s not a &quot;virtual&quot; call =
in the language sense; it&#39;s a virtual call in the polymorphic sense.<br=
><br>I like the idea of being able to take a concept and turn it into a typ=
e that can type-erase any type that matches the concept. This allows you to=
 turn a compile-time polymorphism tool into a runtime polymorphism tool. Bu=
t if you want to do it directly through concepts, then this should include =
more than just member functions. The type-erasure/code generation now needs=
 to include any operations specified by the concept, including overloaded o=
perators, global ADL functions, and the like.<br><br>I would also want to s=
ee some way of defining copy/move behavior. That is, whether the conversion=
 to the &quot;interface&quot; type will create its own object (like `any` o=
r `function`) or whether it will just reference an existing one, as well as=
 specifying whether the type is move-only or copyable.<br></div></div><span=
 class=3D"">

<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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e8fb03f4-8c94-46c2-a612-acab81117998%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/e8fb=
03f4-8c94-46c2-<wbr>a612-acab81117998%40isocpp.org</a><wbr>.<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"gmail_sig=
nature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div>Be seeing =
you,<br></div>Tony<br></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/CAOHCbiswurpbE6tG3igWTsFfpJ%3DLAeT9Po=
TUZBNsrnMOhEwSxQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbiswurpbE6=
tG3igWTsFfpJ%3DLAeT9PoTUZBNsrnMOhEwSxQ%40mail.gmail.com</a>.<br />

--f403045f2ed6a0c634054f08d81f--

.
