Topic: Interfaces + concepts


Author: HarD Gamer <rodrigojose690@gmail.com>
Date: Mon, 10 Apr 2017 17:09:14 -0700 (PDT)
Raw View
------=_Part_236_1691552905.1491869354219
Content-Type: multipart/alternative;
 boundary="----=_Part_237_2058572360.1491869354220"

------=_Part_237_2058572360.1491869354220
Content-Type: text/plain; charset=UTF-8

now, we write like this:

class IOutputStream
{
public:
virtual void write(const ByteArray &) = 0;
virtual int printf(const ByteArray &, auto &&...args) = 0;
}

with the proposal:

interface IOutputStream
{
void write(const ByteArray &);
int printf(const ByteArray &, auto &&...args);
}

This is not a class or a struct, it's a interface:
methods public by default.

Interfaces + Concepts

Gives the ability to chosse if need use as a interface or  concept:

interface Sumable concept
{
int operator +(int);
int& operator +=(int);
}


struct MyClass : public Sumable
{
int self;
int operator +(const MyClass &other)
{
return this->self + other.self;
}
int& operator +=(const MyClass &other)
{
self += other.self;
return this->self;
}
}

int doSum(Sumable a, Sumable b)
{
a + b;
}

doSum(4, 5); // Ok use the concept

MyClass a {1}, b {5};

doSum(a, b); // Ok use the interface

--
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/ff1b952d-e929-498c-bfc9-4919a2b4e9d1%40isocpp.org.

------=_Part_237_2058572360.1491869354220
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>now, we write like this:</div><div><br></div><div><fo=
nt face=3D"courier new, monospace">class IOutputStream</font></div><div><fo=
nt face=3D"courier new, monospace">{</font></div><div><font face=3D"courier=
 new, monospace">public:</font></div><div><font face=3D"courier new, monosp=
ace"><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>virtu=
al void write(const ByteArray &amp;) =3D 0;<span class=3D"Apple-tab-span" s=
tyle=3D"white-space:pre"> </span></font></div><div><font face=3D"courier ne=
w, monospace"><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </s=
pan>virtual int printf(const ByteArray &amp;, auto &amp;&amp;...args) =3D 0=
;</font></div><div><font face=3D"courier new, monospace">}</font></div><div=
><br></div><div>with the proposal:</div><div><font face=3D"courier new, mon=
ospace"><br></font></div><div><font face=3D"courier new, monospace">interfa=
ce IOutputStream=C2=A0</font></div><div><font face=3D"courier new, monospac=
e">{</font></div><div><font face=3D"courier new, monospace"><span class=3D"=
Apple-tab-span" style=3D"white-space:pre"> </span>void write(const ByteArra=
y &amp;);<span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><=
/font></div><div><font face=3D"courier new, monospace"><span class=3D"Apple=
-tab-span" style=3D"white-space:pre"> </span>int printf(const ByteArray &am=
p;, auto &amp;&amp;...args);</font></div><div><font face=3D"courier new, mo=
nospace">}</font></div><div><br></div><div>This is not a class or a struct,=
 it&#39;s a interface:</div><div>methods public by default.</div><div><br><=
/div><div>Interfaces + Concepts</div><div><br></div><div>Gives the ability =
to chosse if need use as a interface or =C2=A0concept:</div><div><font face=
=3D"courier new, monospace"><br></font></div><div><font face=3D"courier new=
, monospace">interface Sumable concept</font></div><div><font face=3D"couri=
er new, monospace">{</font></div><div><font face=3D"courier new, monospace"=
><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>int opera=
tor +(int);</font></div><div><font face=3D"courier new, monospace"><span cl=
ass=3D"Apple-tab-span" style=3D"white-space:pre"> </span>int&amp; operator =
+=3D(int);</font></div><div><font face=3D"courier new, monospace">}</font><=
/div><div><font face=3D"courier new, monospace"><br></font></div><div><font=
 face=3D"courier new, monospace"><br></font></div><div><font face=3D"courie=
r new, monospace">struct MyClass : public Sumable</font></div><div><font fa=
ce=3D"courier new, monospace">{</font></div><div><font face=3D"courier new,=
 monospace"><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </spa=
n>int self;</font></div><div><span class=3D"Apple-tab-span" style=3D"white-=
space:pre"><font face=3D"courier new, monospace"> </font></span></div><div>=
<font face=3D"courier new, monospace"><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>int operator +(const MyClass &amp;other)=C2=A0=
</font></div><div><font face=3D"courier new, monospace"><span class=3D"Appl=
e-tab-span" style=3D"white-space:pre"> </span>{</font></div><div><font face=
=3D"courier new, monospace"><span class=3D"Apple-tab-span" style=3D"white-s=
pace:pre">  </span>return this-&gt;self + other.self;</font></div><div><fon=
t face=3D"courier new, monospace"><span class=3D"Apple-tab-span" style=3D"w=
hite-space:pre"> </span>}</font></div><div><span class=3D"Apple-tab-span" s=
tyle=3D"white-space:pre"><font face=3D"courier new, monospace"> </font></sp=
an></div><div><font face=3D"courier new, monospace"><span class=3D"Apple-ta=
b-span" style=3D"white-space:pre"> </span>int&amp; operator +=3D(const MyCl=
ass &amp;other)</font></div><div><font face=3D"courier new, monospace"><spa=
n class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>{</font></div>=
<div><font face=3D"courier new, monospace"><span class=3D"Apple-tab-span" s=
tyle=3D"white-space:pre">  </span>self +=3D other.self;</font></div><div><f=
ont face=3D"courier new, monospace"><span class=3D"Apple-tab-span" style=3D=
"white-space:pre">  </span>return this-&gt;self;</font></div><div><font fac=
e=3D"courier new, monospace"><span class=3D"Apple-tab-span" style=3D"white-=
space:pre"> </span>}</font></div><div><font face=3D"courier new, monospace"=
>}</font></div><div><font face=3D"courier new, monospace"><br></font></div>=
<div><font face=3D"courier new, monospace">int doSum(Sumable a, Sumable b)<=
/font></div><div><font face=3D"courier new, monospace">{</font></div><div><=
font face=3D"courier new, monospace"><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>a + b;</font></div><div><font face=3D"courier =
new, monospace">}</font></div><div><font face=3D"courier new, monospace"><b=
r></font></div><div><font face=3D"courier new, monospace">doSum(4, 5); // O=
k use the concept</font></div><div><font face=3D"courier new, monospace"><b=
r></font></div><div><font face=3D"courier new, monospace">MyClass a {1}, b =
{5};</font></div><div><font face=3D"courier new, monospace"><br></font></di=
v><div><font face=3D"courier new, monospace">doSum(a, b); // Ok use the int=
erface</font></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/ff1b952d-e929-498c-bfc9-4919a2b4e9d1%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ff1b952d-e929-498c-bfc9-4919a2b4e9d1=
%40isocpp.org</a>.<br />

------=_Part_237_2058572360.1491869354220--

------=_Part_236_1691552905.1491869354219--

.


Author: Patrice Roy <patricer@gmail.com>
Date: Mon, 10 Apr 2017 21:11:37 -0400
Raw View
--f403045ddb7a136d9f054cd9c611
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Could you please describe the benefits compared to what we do right now? It
would help appreciate what you are trying to achieve.

Note that there are many aliases and macros names =C2=ABinterface=C2=BB out=
 there
already. This will probably cause all sorts of problems with existing code,
so benefits have to be significant.

Thanks!

2017-04-10 20:09 GMT-04:00 HarD Gamer <rodrigojose690@gmail.com>:

> now, we write like this:
>
> class IOutputStream
> {
> public:
> virtual void write(const ByteArray &) =3D 0;
> virtual int printf(const ByteArray &, auto &&...args) =3D 0;
> }
>
> with the proposal:
>
> interface IOutputStream
> {
> void write(const ByteArray &);
> int printf(const ByteArray &, auto &&...args);
> }
>
> This is not a class or a struct, it's a interface:
> methods public by default.
>
> Interfaces + Concepts
>
> Gives the ability to chosse if need use as a interface or  concept:
>
> interface Sumable concept
> {
> int operator +(int);
> int& operator +=3D(int);
> }
>
>
> struct MyClass : public Sumable
> {
> int self;
> int operator +(const MyClass &other)
> {
> return this->self + other.self;
> }
> int& operator +=3D(const MyClass &other)
> {
> self +=3D other.self;
> return this->self;
> }
> }
>
> int doSum(Sumable a, Sumable b)
> {
> a + b;
> }
>
> doSum(4, 5); // Ok use the concept
>
> MyClass a {1}, b {5};
>
> doSum(a, b); // Ok use the interface
>
> --
> 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/ff1b952d-e929-498c-
> bfc9-4919a2b4e9d1%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ff1b952d-e9=
29-498c-bfc9-4919a2b4e9d1%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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/CAKiZDp0zTreJx8s7R0J0pbVi-M0QVAqB%2B-bQc3KN9BTf%=
2BTcpoQ%40mail.gmail.com.

--f403045ddb7a136d9f054cd9c611
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Could you please describe the benefits compared to wh=
at we do right now? It would help appreciate what you are trying to achieve=
..<br><br></div>Note that there are many aliases and macros names =C2=ABinte=
rface=C2=BB out there already. This will probably cause all sorts of proble=
ms with existing code, so benefits have to be significant.<br><div><br>Than=
ks!<br></div></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote=
">2017-04-10 20:09 GMT-04:00 HarD Gamer <span dir=3D"ltr">&lt;<a href=3D"ma=
ilto:rodrigojose690@gmail.com" target=3D"_blank">rodrigojose690@gmail.com</=
a>&gt;</span>:<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"><div>now,=
 we write like this:</div><div><br></div><div><font face=3D"courier new, mo=
nospace">class IOutputStream</font></div><div><font face=3D"courier new, mo=
nospace">{</font></div><div><font face=3D"courier new, monospace">public:</=
font></div><div><font face=3D"courier new, monospace"><span class=3D"m_9134=
824393555712849Apple-tab-span" style=3D"white-space:pre-wrap"> </span>virtu=
al void write(const ByteArray &amp;) =3D 0;<span class=3D"m_913482439355571=
2849Apple-tab-span" style=3D"white-space:pre-wrap"> </span></font></div><di=
v><font face=3D"courier new, monospace"><span class=3D"m_913482439355571284=
9Apple-tab-span" style=3D"white-space:pre-wrap"> </span>virtual int printf(=
const ByteArray &amp;, auto &amp;&amp;...args) =3D 0;</font></div><div><fon=
t face=3D"courier new, monospace">}</font></div><div><br></div><div>with th=
e proposal:</div><div><font face=3D"courier new, monospace"><br></font></di=
v><div><font face=3D"courier new, monospace">interface IOutputStream=C2=A0<=
/font></div><div><font face=3D"courier new, monospace">{</font></div><div><=
font face=3D"courier new, monospace"><span class=3D"m_9134824393555712849Ap=
ple-tab-span" style=3D"white-space:pre-wrap"> </span>void write(const ByteA=
rray &amp;);<span class=3D"m_9134824393555712849Apple-tab-span" style=3D"wh=
ite-space:pre-wrap"> </span></font></div><div><font face=3D"courier new, mo=
nospace"><span class=3D"m_9134824393555712849Apple-tab-span" style=3D"white=
-space:pre-wrap"> </span>int printf(const ByteArray &amp;, auto &amp;&amp;.=
...args);</font></div><div><font face=3D"courier new, monospace">}</font></d=
iv><div><br></div><div>This is not a class or a struct, it&#39;s a interfac=
e:</div><div>methods public by default.</div><div><br></div><div>Interfaces=
 + Concepts</div><div><br></div><div>Gives the ability to chosse if need us=
e as a interface or =C2=A0concept:</div><div><font face=3D"courier new, mon=
ospace"><br></font></div><div><font face=3D"courier new, monospace">interfa=
ce Sumable concept</font></div><div><font face=3D"courier new, monospace">{=
</font></div><div><font face=3D"courier new, monospace"><span class=3D"m_91=
34824393555712849Apple-tab-span" style=3D"white-space:pre-wrap"> </span>int=
 operator +(int);</font></div><div><font face=3D"courier new, monospace"><s=
pan class=3D"m_9134824393555712849Apple-tab-span" style=3D"white-space:pre-=
wrap"> </span>int&amp; operator +=3D(int);</font></div><div><font face=3D"c=
ourier new, monospace">}</font></div><div><font face=3D"courier new, monosp=
ace"><br></font></div><div><font face=3D"courier new, monospace"><br></font=
></div><div><font face=3D"courier new, monospace">struct MyClass : public S=
umable</font></div><div><font face=3D"courier new, monospace">{</font></div=
><div><font face=3D"courier new, monospace"><span class=3D"m_91348243935557=
12849Apple-tab-span" style=3D"white-space:pre-wrap"> </span>int self;</font=
></div><div><span class=3D"m_9134824393555712849Apple-tab-span" style=3D"wh=
ite-space:pre-wrap"><font face=3D"courier new, monospace"> </font></span></=
div><div><font face=3D"courier new, monospace"><span class=3D"m_91348243935=
55712849Apple-tab-span" style=3D"white-space:pre-wrap"> </span>int operator=
 +(const MyClass &amp;other)=C2=A0</font></div><div><font face=3D"courier n=
ew, monospace"><span class=3D"m_9134824393555712849Apple-tab-span" style=3D=
"white-space:pre-wrap"> </span>{</font></div><div><font face=3D"courier new=
, monospace"><span class=3D"m_9134824393555712849Apple-tab-span" style=3D"w=
hite-space:pre-wrap">  </span>return this-&gt;self + other.self;</font></di=
v><div><font face=3D"courier new, monospace"><span class=3D"m_9134824393555=
712849Apple-tab-span" style=3D"white-space:pre-wrap"> </span>}</font></div>=
<div><span class=3D"m_9134824393555712849Apple-tab-span" style=3D"white-spa=
ce:pre-wrap"><font face=3D"courier new, monospace"> </font></span></div><di=
v><font face=3D"courier new, monospace"><span class=3D"m_913482439355571284=
9Apple-tab-span" style=3D"white-space:pre-wrap"> </span>int&amp; operator +=
=3D(const MyClass &amp;other)</font></div><div><font face=3D"courier new, m=
onospace"><span class=3D"m_9134824393555712849Apple-tab-span" style=3D"whit=
e-space:pre-wrap"> </span>{</font></div><div><font face=3D"courier new, mon=
ospace"><span class=3D"m_9134824393555712849Apple-tab-span" style=3D"white-=
space:pre-wrap">  </span>self +=3D other.self;</font></div><div><font face=
=3D"courier new, monospace"><span class=3D"m_9134824393555712849Apple-tab-s=
pan" style=3D"white-space:pre-wrap">  </span>return this-&gt;self;</font></=
div><div><font face=3D"courier new, monospace"><span class=3D"m_91348243935=
55712849Apple-tab-span" style=3D"white-space:pre-wrap"> </span>}</font></di=
v><div><font face=3D"courier new, monospace">}</font></div><div><font face=
=3D"courier new, monospace"><br></font></div><div><font face=3D"courier new=
, monospace">int doSum(Sumable a, Sumable b)</font></div><div><font face=3D=
"courier new, monospace">{</font></div><div><font face=3D"courier new, mono=
space"><span class=3D"m_9134824393555712849Apple-tab-span" style=3D"white-s=
pace:pre-wrap"> </span>a + b;</font></div><div><font face=3D"courier new, m=
onospace">}</font></div><div><font face=3D"courier new, monospace"><br></fo=
nt></div><div><font face=3D"courier new, monospace">doSum(4, 5); // Ok use =
the concept</font></div><div><font face=3D"courier new, monospace"><br></fo=
nt></div><div><font face=3D"courier new, monospace">MyClass a {1}, b {5};</=
font></div><div><font face=3D"courier new, monospace"><br></font></div><div=
><font face=3D"courier new, monospace">doSum(a, b); // Ok use the interface=
</font></div></div><span class=3D"HOEnZb"><font color=3D"#888888">

<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>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ff1b952d-e929-498c-bfc9-4919a2b4e9d1%=
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/ff1b=
952d-e929-498c-<wbr>bfc9-4919a2b4e9d1%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br></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/CAKiZDp0zTreJx8s7R0J0pbVi-M0QVAqB%2B-=
bQc3KN9BTf%2BTcpoQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKiZDp0zTreJ=
x8s7R0J0pbVi-M0QVAqB%2B-bQc3KN9BTf%2BTcpoQ%40mail.gmail.com</a>.<br />

--f403045ddb7a136d9f054cd9c611--

.


Author: Christopher Di Bella <cjdb.ns@gmail.com>
Date: Tue, 11 Apr 2017 01:22:20 +0000
Raw View
--001a114315ee003cd2054cd9edd5
Content-Type: text/plain; charset=UTF-8

It's hard to say without motivation or use-cases, but I think concepts
already do everything you'd like, barring the virtual functions.

It's also unclear if your proposal suggests that interfaces are 'guards' to
a template parameter, like concepts, or if they're a mandatory type
specifier, like in Java.

With terse concept syntax, whether your implementation is compile-time
polymorphic or run-time polymorphic is just an implementation detail.


On Tue., 11 Apr. 2017, 10:09 HarD Gamer, <rodrigojose690@gmail.com> wrote:

now, we write like this:

class IOutputStream
{
public:
virtual void write(const ByteArray &) = 0;
virtual int printf(const ByteArray &, auto &&...args) = 0;
}

with the proposal:

interface IOutputStream
{
void write(const ByteArray &);
int printf(const ByteArray &, auto &&...args);
}

This is not a class or a struct, it's a interface:
methods public by default.

Interfaces + Concepts

Gives the ability to chosse if need use as a interface or  concept:

interface Sumable concept
{
int operator +(int);
int& operator +=(int);
}


struct MyClass : public Sumable
{
int self;
int operator +(const MyClass &other)
{
return this->self + other.self;
}
int& operator +=(const MyClass &other)
{
self += other.self;
return this->self;
}
}

int doSum(Sumable a, Sumable b)
{
a + b;
}

doSum(4, 5); // Ok use the concept

MyClass a {1}, b {5};

doSum(a, b); // Ok use the interface

--
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/ff1b952d-e929-498c-bfc9-4919a2b4e9d1%40isocpp.org
<https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ff1b952d-e929-498c-bfc9-4919a2b4e9d1%40isocpp.org?utm_medium=email&utm_source=footer>
..

--
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/CACL3gUV2aJy0JjCWafYgjkxBFGNpc71QB_JfYdQ7%2BXTL4575ig%40mail.gmail.com.

--001a114315ee003cd2054cd9edd5
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr" class=3D"gmail_msg">It&#39;s hard to say without motivatio=
n or use-cases, but I think concepts already do everything you&#39;d like, =
barring the virtual functions.</div><div dir=3D"ltr" class=3D"gmail_msg"><b=
r></div><div dir=3D"ltr" class=3D"gmail_msg">It&#39;s also unclear if your =
proposal suggests that interfaces are &#39;guards&#39; to a template parame=
ter, like concepts, or if they&#39;re a mandatory type specifier, like in J=
ava.<br></div><div dir=3D"ltr" class=3D"gmail_msg"><br></div><div dir=3D"lt=
r" class=3D"gmail_msg">With terse concept syntax, whether your implementati=
on is compile-time polymorphic or run-time polymorphic is just an implement=
ation detail.</div><div dir=3D"ltr" class=3D"gmail_msg"><br></div><span>
</span><br class=3D"gmail_msg"><div class=3D"gmail_quote gmail_msg"><div di=
r=3D"ltr" class=3D"gmail_msg">On Tue., 11 Apr. 2017, 10:09 HarD Gamer, &lt;=
<a href=3D"mailto:rodrigojose690@gmail.com" class=3D"gmail_msg" target=3D"_=
blank">rodrigojose690@gmail.com</a>&gt; wrote:<br class=3D"gmail_msg"></div=
><blockquote class=3D"gmail_quote gmail_msg" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr" class=3D"gmail_m=
sg"><div class=3D"gmail_msg">now, we write like this:</div><div class=3D"gm=
ail_msg"><br class=3D"gmail_msg"></div><div class=3D"gmail_msg"><font face=
=3D"courier new, monospace" class=3D"gmail_msg">class IOutputStream</font><=
/div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" class=
=3D"gmail_msg">{</font></div><div class=3D"gmail_msg"><font face=3D"courier=
 new, monospace" class=3D"gmail_msg">public:</font></div><div class=3D"gmai=
l_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg"><span clas=
s=3D"m_-8517104322967991393m_-6572613562730325218Apple-tab-span gmail_msg" =
style=3D"white-space:pre-wrap"> </span>virtual void write(const ByteArray &=
amp;) =3D 0;<span class=3D"m_-8517104322967991393m_-6572613562730325218Appl=
e-tab-span gmail_msg" style=3D"white-space:pre-wrap"> </span></font></div><=
div class=3D"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmai=
l_msg"><span class=3D"m_-8517104322967991393m_-6572613562730325218Apple-tab=
-span gmail_msg" style=3D"white-space:pre-wrap"> </span>virtual int printf(=
const ByteArray &amp;, auto &amp;&amp;...args) =3D 0;</font></div><div clas=
s=3D"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg">}=
</font></div><div class=3D"gmail_msg"><br class=3D"gmail_msg"></div><div cl=
ass=3D"gmail_msg">with the proposal:</div><div class=3D"gmail_msg"><font fa=
ce=3D"courier new, monospace" class=3D"gmail_msg"><br class=3D"gmail_msg"><=
/font></div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" =
class=3D"gmail_msg">interface IOutputStream=C2=A0</font></div><div class=3D=
"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg">{</fo=
nt></div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" cla=
ss=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-657261356273032521=
8Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap"> </span>void writ=
e(const ByteArray &amp;);<span class=3D"m_-8517104322967991393m_-6572613562=
730325218Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap"> </span><=
/font></div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" =
class=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-657261356273032=
5218Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap"> </span>int pr=
intf(const ByteArray &amp;, auto &amp;&amp;...args);</font></div><div class=
=3D"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg">}<=
/font></div><div class=3D"gmail_msg"><br class=3D"gmail_msg"></div><div cla=
ss=3D"gmail_msg">This is not a class or a struct, it&#39;s a interface:</di=
v><div class=3D"gmail_msg">methods public by default.</div><div class=3D"gm=
ail_msg"><br class=3D"gmail_msg"></div><div class=3D"gmail_msg">Interfaces =
+ Concepts</div><div class=3D"gmail_msg"><br class=3D"gmail_msg"></div><div=
 class=3D"gmail_msg">Gives the ability to chosse if need use as a interface=
 or =C2=A0concept:</div><div class=3D"gmail_msg"><font face=3D"courier new,=
 monospace" class=3D"gmail_msg"><br class=3D"gmail_msg"></font></div><div c=
lass=3D"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg=
">interface Sumable concept</font></div><div class=3D"gmail_msg"><font face=
=3D"courier new, monospace" class=3D"gmail_msg">{</font></div><div class=3D=
"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg"><span=
 class=3D"m_-8517104322967991393m_-6572613562730325218Apple-tab-span gmail_=
msg" style=3D"white-space:pre-wrap"> </span>int operator +(int);</font></di=
v><div class=3D"gmail_msg"><font face=3D"courier new, monospace" class=3D"g=
mail_msg"><span class=3D"m_-8517104322967991393m_-6572613562730325218Apple-=
tab-span gmail_msg" style=3D"white-space:pre-wrap"> </span>int&amp; operato=
r +=3D(int);</font></div><div class=3D"gmail_msg"><font face=3D"courier new=
, monospace" class=3D"gmail_msg">}</font></div><div class=3D"gmail_msg"><fo=
nt face=3D"courier new, monospace" class=3D"gmail_msg"><br class=3D"gmail_m=
sg"></font></div><div class=3D"gmail_msg"><font face=3D"courier new, monosp=
ace" class=3D"gmail_msg"><br class=3D"gmail_msg"></font></div><div class=3D=
"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg">struc=
t MyClass : public Sumable</font></div><div class=3D"gmail_msg"><font face=
=3D"courier new, monospace" class=3D"gmail_msg">{</font></div><div class=3D=
"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg"><span=
 class=3D"m_-8517104322967991393m_-6572613562730325218Apple-tab-span gmail_=
msg" style=3D"white-space:pre-wrap"> </span>int self;</font></div><div clas=
s=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-6572613562730325218=
Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap"><font face=3D"cour=
ier new, monospace" class=3D"gmail_msg"> </font></span></div><div class=3D"=
gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg"><span =
class=3D"m_-8517104322967991393m_-6572613562730325218Apple-tab-span gmail_m=
sg" style=3D"white-space:pre-wrap"> </span>int operator +(const MyClass &am=
p;other)=C2=A0</font></div><div class=3D"gmail_msg"><font face=3D"courier n=
ew, monospace" class=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-=
6572613562730325218Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap"=
> </span>{</font></div><div class=3D"gmail_msg"><font face=3D"courier new, =
monospace" class=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-6572=
613562730325218Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap">  <=
/span>return this-&gt;self + other.self;</font></div><div class=3D"gmail_ms=
g"><font face=3D"courier new, monospace" class=3D"gmail_msg"><span class=3D=
"m_-8517104322967991393m_-6572613562730325218Apple-tab-span gmail_msg" styl=
e=3D"white-space:pre-wrap"> </span>}</font></div><div class=3D"gmail_msg"><=
span class=3D"m_-8517104322967991393m_-6572613562730325218Apple-tab-span gm=
ail_msg" style=3D"white-space:pre-wrap"><font face=3D"courier new, monospac=
e" class=3D"gmail_msg"> </font></span></div><div class=3D"gmail_msg"><font =
face=3D"courier new, monospace" class=3D"gmail_msg"><span class=3D"m_-85171=
04322967991393m_-6572613562730325218Apple-tab-span gmail_msg" style=3D"whit=
e-space:pre-wrap"> </span>int&amp; operator +=3D(const MyClass &amp;other)<=
/font></div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" =
class=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-657261356273032=
5218Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap"> </span>{</fon=
t></div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" clas=
s=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-6572613562730325218=
Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap">  </span>self +=3D=
 other.self;</font></div><div class=3D"gmail_msg"><font face=3D"courier new=
, monospace" class=3D"gmail_msg"><span class=3D"m_-8517104322967991393m_-65=
72613562730325218Apple-tab-span gmail_msg" style=3D"white-space:pre-wrap"> =
 </span>return this-&gt;self;</font></div><div class=3D"gmail_msg"><font fa=
ce=3D"courier new, monospace" class=3D"gmail_msg"><span class=3D"m_-8517104=
322967991393m_-6572613562730325218Apple-tab-span gmail_msg" style=3D"white-=
space:pre-wrap"> </span>}</font></div><div class=3D"gmail_msg"><font face=
=3D"courier new, monospace" class=3D"gmail_msg">}</font></div><div class=3D=
"gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg"><br c=
lass=3D"gmail_msg"></font></div><div class=3D"gmail_msg"><font face=3D"cour=
ier new, monospace" class=3D"gmail_msg">int doSum(Sumable a, Sumable b)</fo=
nt></div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" cla=
ss=3D"gmail_msg">{</font></div><div class=3D"gmail_msg"><font face=3D"couri=
er new, monospace" class=3D"gmail_msg"><span class=3D"m_-851710432296799139=
3m_-6572613562730325218Apple-tab-span gmail_msg" style=3D"white-space:pre-w=
rap"> </span>a + b;</font></div><div class=3D"gmail_msg"><font face=3D"cour=
ier new, monospace" class=3D"gmail_msg">}</font></div><div class=3D"gmail_m=
sg"><font face=3D"courier new, monospace" class=3D"gmail_msg"><br class=3D"=
gmail_msg"></font></div><div class=3D"gmail_msg"><font face=3D"courier new,=
 monospace" class=3D"gmail_msg">doSum(4, 5); // Ok use the concept</font></=
div><div class=3D"gmail_msg"><font face=3D"courier new, monospace" class=3D=
"gmail_msg"><br class=3D"gmail_msg"></font></div><div class=3D"gmail_msg"><=
font face=3D"courier new, monospace" class=3D"gmail_msg">MyClass a {1}, b {=
5};</font></div><div class=3D"gmail_msg"><font face=3D"courier new, monospa=
ce" class=3D"gmail_msg"><br class=3D"gmail_msg"></font></div><div class=3D"=
gmail_msg"><font face=3D"courier new, monospace" class=3D"gmail_msg">doSum(=
a, b); // Ok use the interface</font></div></div>

<p class=3D"gmail_msg"></p>

-- <br class=3D"gmail_msg">
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br class=3D"gmail_msg=
">
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" class=3D"gm=
ail_msg" target=3D"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br cla=
ss=3D"gmail_msg">
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" class=3D"gmail_msg" target=3D"_blank">std-proposals@isocpp.org</a>.<b=
r class=3D"gmail_msg">
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ff1b952d-e929-498c-bfc9-4919a2b4e9d1%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" class=3D"gmail_msg=
" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-prop=
osals/ff1b952d-e929-498c-bfc9-4919a2b4e9d1%40isocpp.org</a>.<br class=3D"gm=
ail_msg">
</blockquote></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/CACL3gUV2aJy0JjCWafYgjkxBFGNpc71QB_Jf=
YdQ7%2BXTL4575ig%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACL3gUV2aJy0Jj=
CWafYgjkxBFGNpc71QB_JfYdQ7%2BXTL4575ig%40mail.gmail.com</a>.<br />

--001a114315ee003cd2054cd9edd5--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 10 Apr 2017 23:19:08 -0700
Raw View
Em segunda-feira, 10 de abril de 2017, =C3=A0s 17:09:14 PDT, HarD Gamer esc=
reveu:
> int doSum(Sumable a, Sumable b)
> {
> a + b;
> }

Does this have to be inline? How would you write an out-of-line for the=20
implementation operating on the virtual base?

>=20
> doSum(4, 5); // Ok use the concept
>=20
> MyClass a {1}, b {5};
>=20
> doSum(a, b); // Ok use the interface


--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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/2015120.o8AGLI73pd%40tjmaciei-mobl1.

.