Topic: Static Polymorphism as language feature


Author: =?UTF-8?Q?M=C3=A1t=C3=A9_Ferenc_Nagy-Egri?= <nagymatef@gmail.com>
Date: Thu, 13 Mar 2014 08:23:59 -0700 (PDT)
Raw View
------=_Part_295_6079475.1394724239064
Content-Type: text/plain; charset=UTF-8

Since I come across CRTP, and other means of static polymorphism, I have
found that it is the coolest C++'s "feature" of all times. I am looking
towards using CRTP as a means of building an AST and using it to generate
GPU kernel code. I have most things in my head, but when I did the first
toy case using standard STL back-end, I come across an issue I cannot seem
to resolve, and it seem to be at the core of CRTP. While there are
solutions, they are all criptic to say the least, or seem completely
inside-out.

For eg. this <http://stackoverflow.com/a/11928661/1476661> problem is a
perfect example of how a workaround to a problem just seems awfully
unnecessary. Sean Parent's presentation<http://channel9.msdn.com/Events/GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil>at Going::Native shows another problem and another solution, which yet
again is counter-intuitive if nothing else. Other presentations mentioned
how compiler devs are sweating blood in order to devirtualize functions,
and what magic compilers must do to prove that a function can be
devirtualized. Why cannot the programmer state it's intent, that the chain
of inheritance between certain classes will never depend on runtime
variables and are guaranteed to be deducible at compile time? That way I
could have my interfaces templated too, as I can promise to the compiler
that it will see all of the types that a member function is called with.

I would like to say something like:

class Geometry
{
public:

    template <typename T> void rotate(T radians);
};

class Triangle | public Geometry // Note "|" instead of ":"
{
public:

    //CTOR

    template <typename T> void rotate(T radians) { /* Use radians to rotate
coordinates */ }

private:

    double x, y, z;
};


Triangle my_tri;

my_tri.rotate(1.0);
my_tri.rotate(1);

As far as I can tell, concepts will be able to do something different,
however I am unsure whether concepts will remind me at compile time, if I
failed to provide an implementation to a function that is part of the
concept. Or is there at all any static checking of my class when I say it
implements a concept? Could it be used in a templated manner?

I am not a C++ expert, therefore I sometimes fail to see the bigger
picture, but I definately know that static polymorphism must not be se
obscure. I do not know what are the minimal constraints that must be made
so that such a feature is implementable in a compiler. I know that the
reason why virtual functions cannot be templated is because there is no way
to tell ahead of time, how many template types will be substituted into the
arguements, which each will need an entry in the vtable. However, once a
function is marked for devirtualization, it might as well have been
templated. I do not know if constraints must be such that I cannot assign a
Triangle* to an instance of Geometry*, or whether it must be something else.

What do you guys think about this? Am I horridly on the wrong track? Does
any of this make sense? Even if my idea as it is now doesn't make sense, is
there another form that could be used to define interfaces and implement
them in a static manner? I do not feel educated enough to be able to write
a full fledged C++ proposal, but I do have the feeling that something is
missing from the language.

--

---
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/.

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

<div dir=3D"ltr"><div>Since I come across CRTP, and other means of static p=
olymorphism, I have found that it is the coolest C++'s "feature" of all tim=
es. I am looking towards using CRTP as a means of building an AST and using=
 it to generate GPU kernel code. I have most things in my head, but when I =
did the first toy case using standard STL back-end, I come across an issue =
I cannot seem to resolve, and it seem to be at the core of CRTP. While ther=
e are solutions, they are all criptic to say the least, or seem completely =
inside-out.</div><div><br></div><div>For eg. <a href=3D"http://stackoverflo=
w.com/a/11928661/1476661">this</a> problem is a perfect example of how a wo=
rkaround to a problem just seems awfully unnecessary. Sean Parent's <a href=
=3D"http://channel9.msdn.com/Events/GoingNative/2013/Inheritance-Is-The-Bas=
e-Class-of-Evil">presentation</a> at Going::Native shows another&nbsp;probl=
em and another solution, which yet again is counter-intuitive if nothing el=
se. Other presentations mentioned how compiler devs are sweating blood in o=
rder to devirtualize functions, and what magic compilers must do to prove t=
hat a function can be devirtualized. Why cannot the programmer state it's i=
ntent, that the chain of inheritance between certain classes will never dep=
end on runtime variables and are guaranteed to be deducible at compile time=
? That way I could have my interfaces templated too, as I can promise to th=
e compiler that it will see all of the types that a member function is call=
ed with.</div><div><br></div><div>I would like to say something like:</div>=
<div><br></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(18=
7, 187, 187); border-image: none; -ms-word-wrap: break-word; background-col=
or: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);"=
>class</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0=
);"> </span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 0, =
102);">Geometry</span><span class=3D"styled-by-prettify" style=3D"color: rg=
b(0, 0, 0);"><br></span><span class=3D"styled-by-prettify" style=3D"color: =
rgb(102, 102, 0);">{</span><span class=3D"styled-by-prettify" style=3D"colo=
r: rgb(0, 0, 0);"><br></span><span class=3D"styled-by-prettify" style=3D"co=
lor: rgb(0, 0, 136);">public</span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(102, 102, 0);">:</span><span class=3D"styled-by-prettify" st=
yle=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><span class=3D"st=
yled-by-prettify" style=3D"color: rgb(0, 0, 136);">template</span><span cla=
ss=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><span clas=
s=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&lt;</span><spa=
n class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">typename</s=
pan><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> T</s=
pan><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&=
gt;</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"=
> </span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);=
">void</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0=
);"> rotate</span><span class=3D"styled-by-prettify" style=3D"color: rgb(10=
2, 102, 0);">(</span><span class=3D"styled-by-prettify" style=3D"color: rgb=
(0, 0, 0);">T radians</span><span class=3D"styled-by-prettify" style=3D"col=
or: rgb(102, 102, 0);">);</span><span class=3D"styled-by-prettify" style=3D=
"color: rgb(0, 0, 0);"><br></span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(102, 102, 0);">};</span><span class=3D"styled-by-prettify" s=
tyle=3D"color: rgb(0, 0, 0);"><br><br></span><span class=3D"styled-by-prett=
ify" style=3D"color: rgb(0, 0, 136);">class</span><span class=3D"styled-by-=
prettify" style=3D"color: rgb(0, 0, 0);"> </span><span class=3D"styled-by-p=
rettify" style=3D"color: rgb(102, 0, 102);">Triangle</span><span class=3D"s=
tyled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><span class=3D"st=
yled-by-prettify" style=3D"color: rgb(102, 102, 0);">|</span><span class=3D=
"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><span class=3D"=
styled-by-prettify" style=3D"color: rgb(0, 0, 136);">public</span><span cla=
ss=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><span clas=
s=3D"styled-by-prettify" style=3D"color: rgb(102, 0, 102);">Geometry</span>=
<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><=
span class=3D"styled-by-prettify" style=3D"color: rgb(136, 0, 0);">// Note =
"|" instead of ":"</span><span class=3D"styled-by-prettify" style=3D"color:=
 rgb(0, 0, 0);"><br></span><span class=3D"styled-by-prettify" style=3D"colo=
r: rgb(102, 102, 0);">{</span><span class=3D"styled-by-prettify" style=3D"c=
olor: rgb(0, 0, 0);"><br></span><span class=3D"styled-by-prettify" style=3D=
"color: rgb(0, 0, 136);">public</span><span class=3D"styled-by-prettify" st=
yle=3D"color: rgb(102, 102, 0);">:</span><span class=3D"styled-by-prettify"=
 style=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><span class=3D=
"styled-by-prettify" style=3D"color: rgb(136, 0, 0);">//CTOR</span><span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; &n=
bsp; </span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 13=
6);">template</span><span class=3D"styled-by-prettify" style=3D"color: rgb(=
0, 0, 0);"> </span><span class=3D"styled-by-prettify" style=3D"color: rgb(1=
02, 102, 0);">&lt;</span><span class=3D"styled-by-prettify" style=3D"color:=
 rgb(0, 0, 136);">typename</span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(0, 0, 0);"> T</span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(102, 102, 0);">&gt;</span><span class=3D"styled-by-prettify"=
 style=3D"color: rgb(0, 0, 0);"> </span><span class=3D"styled-by-prettify" =
style=3D"color: rgb(0, 0, 136);">void</span><span class=3D"styled-by-pretti=
fy" style=3D"color: rgb(0, 0, 0);"> rotate</span><span class=3D"styled-by-p=
rettify" style=3D"color: rgb(102, 102, 0);">(</span><span class=3D"styled-b=
y-prettify" style=3D"color: rgb(0, 0, 0);">T radians</span><span class=3D"s=
tyled-by-prettify" style=3D"color: rgb(102, 102, 0);">)</span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">{</span><span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><span cla=
ss=3D"styled-by-prettify" style=3D"color: rgb(136, 0, 0);">/* Use radians t=
o rotate coordinates */</span><span class=3D"styled-by-prettify" style=3D"c=
olor: rgb(0, 0, 0);"> </span><span class=3D"styled-by-prettify" style=3D"co=
lor: rgb(102, 102, 0);">}</span><span class=3D"styled-by-prettify" style=3D=
"color: rgb(0, 0, 0);"><br><br></span><span class=3D"styled-by-prettify" st=
yle=3D"color: rgb(0, 0, 136);">private</span><span class=3D"styled-by-prett=
ify" style=3D"color: rgb(102, 102, 0);">:</span><span class=3D"styled-by-pr=
ettify" style=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><span c=
lass=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">double</span><=
span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> x</span><=
span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">,</spa=
n><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> y</spa=
n><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">,</=
span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> z</=
span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">=
;</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><=
br></span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, =
0);">};</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, =
0);"><br><br><br></span><span class=3D"styled-by-prettify" style=3D"color: =
rgb(102, 0, 102);">Triangle</span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(0, 0, 0);"> my_tri</span><span class=3D"styled-by-prettify" =
style=3D"color: rgb(102, 102, 0);">;</span><span class=3D"styled-by-prettif=
y" style=3D"color: rgb(0, 0, 0);"><br><br>my_tri</span><span class=3D"style=
d-by-prettify" style=3D"color: rgb(102, 102, 0);">.</span><span class=3D"st=
yled-by-prettify" style=3D"color: rgb(0, 0, 0);">rotate</span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">(</span><span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(0, 102, 102);">1.0</span><sp=
an class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">);</span=
><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br>my_t=
ri</span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0=
);">.</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0)=
;">rotate</span><span class=3D"styled-by-prettify" style=3D"color: rgb(102,=
 102, 0);">(</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0=
, 102, 102);">1</span><span class=3D"styled-by-prettify" style=3D"color: rg=
b(102, 102, 0);">);</span><span class=3D"styled-by-prettify" style=3D"color=
: rgb(0, 0, 0);"><br></span></div></code></div><div><br></div><div>As far a=
s I can tell, concepts will be able to do something different, however I am=
 unsure whether concepts will remind me at compile time, if I failed to pro=
vide an implementation to a function that is part of the concept. Or is the=
re at all any static checking of my class when I say it implements a concep=
t? Could it be used in a templated manner?</div><div><br></div><div>I am no=
t a C++ expert, therefore I sometimes fail to see the bigger picture, but I=
 definately know that static polymorphism must not be se obscure. I do not =
know what are the minimal constraints that must be made so that such a feat=
ure is implementable in a compiler. I know that the reason why virtual func=
tions cannot be templated is because there is no way to tell ahead of time,=
 how many template types will be substituted into the arguements, which eac=
h will need an entry in the vtable. However, once a function is marked for =
devirtualization, it might as well have been templated. I do not know if co=
nstraints must be such that I cannot assign a Triangle* to an instance of G=
eometry*, or whether it must be something else.</div><div><br></div><div>Wh=
at do you guys think about this? Am I horridly on the wrong track? Does any=
 of this make sense? Even if my idea as it is now doesn't make sense, is th=
ere another form that could be used to define interfaces and implement them=
 in a static manner? I do not feel educated enough to be able to write a fu=
ll fledged C++ proposal, but I do have the feeling that something is missin=
g from the language.</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 />

------=_Part_295_6079475.1394724239064--

.


Author: Vincent Reverdy <vince.rev@gmail.com>
Date: Thu, 13 Mar 2014 09:30:01 -0700 (PDT)
Raw View
------=_Part_461_2729293.1394728201397
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi M=C3=A1t=C3=A9,

Oh a link to a SO question of mine. It was some time ago, and in fact (as=
=20
always), it is just a matter of time before getting use to all these=20
tricks. At the end, what you consider as akward now, become natural for=20
you. But for sure, it is neither convenient nor intuitive for someone who=
=20
use standard OO programming. As far as I know, concepts lite will not=20
simplify CRTP, but I think that reflection can. But the question is not=20
exactly the one of complexity, because even if some CRTP cases remain=20
complicated (or "non-intuitive") to implement, metaprogrammers will=20
implement them anyway. The question to ask is: do we want to let the=20
opportunity to non C++ advanced users to use static polymorphism ? And I do=
=20
not see any fundamental reason against the simplification of static=20
polymorphism (but maybe I'm wrong).

The following may be just an enormous mistake, but why not just giving this=
=20
meaning to a member specified as "static virtual" ?

Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=A1t=C3=A9 Ferenc Nagy-Egri a =C3=
=A9crit :
>
> Since I come across CRTP, and other means of static polymorphism, I have=
=20
> found that it is the coolest C++'s "feature" of all times. I am looking=
=20
> towards using CRTP as a means of building an AST and using it to generate=
=20
> GPU kernel code. I have most things in my head, but when I did the first=
=20
> toy case using standard STL back-end, I come across an issue I cannot see=
m=20
> to resolve, and it seem to be at the core of CRTP. While there are=20
> solutions, they are all criptic to say the least, or seem completely=20
> inside-out.
>
> For eg. this <http://stackoverflow.com/a/11928661/1476661> problem is a=
=20
> perfect example of how a workaround to a problem just seems awfully=20
> unnecessary. Sean Parent's presentation<http://channel9.msdn.com/Events/G=
oingNative/2013/Inheritance-Is-The-Base-Class-of-Evil>at Going::Native show=
s another problem and another solution, which yet=20
> again is counter-intuitive if nothing else. Other presentations mentioned=
=20
> how compiler devs are sweating blood in order to devirtualize functions,=
=20
> and what magic compilers must do to prove that a function can be=20
> devirtualized. Why cannot the programmer state it's intent, that the chai=
n=20
> of inheritance between certain classes will never depend on runtime=20
> variables and are guaranteed to be deducible at compile time? That way I=
=20
> could have my interfaces templated too, as I can promise to the compiler=
=20
> that it will see all of the types that a member function is called with.
>
> I would like to say something like:
>
> class Geometry
> {
> public:
>
>     template <typename T> void rotate(T radians);
> };
>
> class Triangle | public Geometry // Note "|" instead of ":"
> {
> public:
>
>     //CTOR
>
>     template <typename T> void rotate(T radians) { /* Use radians to=20
> rotate coordinates */ }
>
> private:
>
>     double x, y, z;
> };
>
>
> Triangle my_tri;
>
> my_tri.rotate(1.0);
> my_tri.rotate(1);
>
> As far as I can tell, concepts will be able to do something different,=20
> however I am unsure whether concepts will remind me at compile time, if I=
=20
> failed to provide an implementation to a function that is part of the=20
> concept. Or is there at all any static checking of my class when I say it=
=20
> implements a concept? Could it be used in a templated manner?
>
> I am not a C++ expert, therefore I sometimes fail to see the bigger=20
> picture, but I definately know that static polymorphism must not be se=20
> obscure. I do not know what are the minimal constraints that must be made=
=20
> so that such a feature is implementable in a compiler. I know that the=20
> reason why virtual functions cannot be templated is because there is no w=
ay=20
> to tell ahead of time, how many template types will be substituted into t=
he=20
> arguements, which each will need an entry in the vtable. However, once a=
=20
> function is marked for devirtualization, it might as well have been=20
> templated. I do not know if constraints must be such that I cannot assign=
 a=20
> Triangle* to an instance of Geometry*, or whether it must be something el=
se.
>
> What do you guys think about this? Am I horridly on the wrong track? Does=
=20
> any of this make sense? Even if my idea as it is now doesn't make sense, =
is=20
> there another form that could be used to define interfaces and implement=
=20
> them in a static manner? I do not feel educated enough to be able to writ=
e=20
> a full fledged C++ proposal, but I do have the feeling that something is=
=20
> missing from the language.
>

--=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/.

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

<div dir=3D"ltr">Hi M=C3=A1t=C3=A9,<br><br>Oh a link to a SO question of mi=
ne. It was some time ago, and in fact (as always), it is just a matter of t=
ime before getting use to all these tricks. At the end, what you consider a=
s akward now, become natural for you. But for sure, it is neither convenien=
t nor intuitive for someone who use standard OO programming. As far as I kn=
ow, concepts lite will not simplify CRTP, but I think that reflection can. =
But the question is not exactly the one of complexity, because even if some=
 CRTP cases remain complicated (or "non-intuitive") to implement, metaprogr=
ammers will implement them anyway. The question to ask is: do we want to le=
t the opportunity to non C++ advanced users to use static polymorphism ? An=
d I do not see any fundamental reason against the simplification of static =
polymorphism (but maybe I'm wrong).<br><br>The following may be just an eno=
rmous mistake, but why not just giving this meaning to a member specified a=
s "<span style=3D"font-family: courier new,monospace;">static virtual</span=
>" ?<br><br>Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=A1t=C3=A9 Ferenc Nag=
y-Egri a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div=
 dir=3D"ltr"><div>Since I come across CRTP, and other means of static polym=
orphism, I have found that it is the coolest C++'s "feature" of all times. =
I am looking towards using CRTP as a means of building an AST and using it =
to generate GPU kernel code. I have most things in my head, but when I did =
the first toy case using standard STL back-end, I come across an issue I ca=
nnot seem to resolve, and it seem to be at the core of CRTP. While there ar=
e solutions, they are all criptic to say the least, or seem completely insi=
de-out.</div><div><br></div><div>For eg. <a href=3D"http://stackoverflow.co=
m/a/11928661/1476661" target=3D"_blank" onmousedown=3D"this.href=3D'http://=
www.google.com/url?q\75http%3A%2F%2Fstackoverflow.com%2Fa%2F11928661%2F1476=
661\46sa\75D\46sntz\0751\46usg\75AFQjCNEkKtNP4gv3b8mMQo5Zzp18RJ7VZg';return=
 true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2F=
stackoverflow.com%2Fa%2F11928661%2F1476661\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNEkKtNP4gv3b8mMQo5Zzp18RJ7VZg';return true;">this</a> problem is a perfec=
t example of how a workaround to a problem just seems awfully unnecessary. =
Sean Parent's <a href=3D"http://channel9.msdn.com/Events/GoingNative/2013/I=
nheritance-Is-The-Base-Class-of-Evil" target=3D"_blank" onmousedown=3D"this=
..href=3D'http://www.google.com/url?q\75http%3A%2F%2Fchannel9.msdn.com%2FEve=
nts%2FGoingNative%2F2013%2FInheritance-Is-The-Base-Class-of-Evil\46sa\75D\4=
6sntz\0751\46usg\75AFQjCNHVlpf_jVIeF8I3kBy0FblJ9lq5gA';return true;" onclic=
k=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fchannel9.msdn.=
com%2FEvents%2FGoingNative%2F2013%2FInheritance-Is-The-Base-Class-of-Evil\4=
6sa\75D\46sntz\0751\46usg\75AFQjCNHVlpf_jVIeF8I3kBy0FblJ9lq5gA';return true=
;">presentation</a> at Going::Native shows another&nbsp;problem and another=
 solution, which yet again is counter-intuitive if nothing else. Other pres=
entations mentioned how compiler devs are sweating blood in order to devirt=
ualize functions, and what magic compilers must do to prove that a function=
 can be devirtualized. Why cannot the programmer state it's intent, that th=
e chain of inheritance between certain classes will never depend on runtime=
 variables and are guaranteed to be deducible at compile time? That way I c=
ould have my interfaces templated too, as I can promise to the compiler tha=
t it will see all of the types that a member function is called with.</div>=
<div><br></div><div>I would like to say something like:</div><div><br></div=
><div style=3D"border:1px solid rgb(187,187,187);background-color:rgb(250,2=
50,250)"><code><div><span style=3D"color:rgb(0,0,136)">class</span><span st=
yle=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,102)">Geome=
try</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:=
rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br></span><span s=
tyle=3D"color:rgb(0,0,136)">public</span><span style=3D"color:rgb(102,102,0=
)">:</span><span style=3D"color:rgb(0,0,0)"><br><br>&nbsp; &nbsp; </span><s=
pan style=3D"color:rgb(0,0,136)">template</span><span style=3D"color:rgb(0,=
0,0)"> </span><span style=3D"color:rgb(102,102,0)">&lt;</span><span style=
=3D"color:rgb(0,0,136)">typename</span><span style=3D"color:rgb(0,0,0)"> T<=
/span><span style=3D"color:rgb(102,102,0)">&gt;</span><span style=3D"color:=
rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">void</span><span sty=
le=3D"color:rgb(0,0,0)"> rotate</span><span style=3D"color:rgb(102,102,0)">=
(</span><span style=3D"color:rgb(0,0,0)">T radians</span><span style=3D"col=
or:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br></span><sp=
an style=3D"color:rgb(102,102,0)">};</span><span style=3D"color:rgb(0,0,0)"=
><br><br></span><span style=3D"color:rgb(0,0,136)">class</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,102)">Triangle=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(10=
2,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"c=
olor:rgb(0,0,136)">public</span><span style=3D"color:rgb(0,0,0)"> </span><s=
pan style=3D"color:rgb(102,0,102)">Geometry</span><span style=3D"color:rgb(=
0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">// Note "|" instead of "=
:"</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:r=
gb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br></span><span st=
yle=3D"color:rgb(0,0,136)">public</span><span style=3D"color:rgb(102,102,0)=
">:</span><span style=3D"color:rgb(0,0,0)"><br><br>&nbsp; &nbsp; </span><sp=
an style=3D"color:rgb(136,0,0)">//CTOR</span><span style=3D"color:rgb(0,0,0=
)"><br><br>&nbsp; &nbsp; </span><span style=3D"color:rgb(0,0,136)">template=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(10=
2,102,0)">&lt;</span><span style=3D"color:rgb(0,0,136)">typename</span><spa=
n style=3D"color:rgb(0,0,0)"> T</span><span style=3D"color:rgb(102,102,0)">=
&gt;</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rg=
b(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> rotate</span><span=
 style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">T =
radians</span><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"c=
olor:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</span><span=
 style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">/* U=
se radians to rotate coordinates */</span><span style=3D"color:rgb(0,0,0)">=
 </span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:r=
gb(0,0,0)"><br><br></span><span style=3D"color:rgb(0,0,136)">private</span>=
<span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0=
)"><br><br>&nbsp; &nbsp; </span><span style=3D"color:rgb(0,0,136)">double</=
span><span style=3D"color:rgb(0,0,0)"> x</span><span style=3D"color:rgb(102=
,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> y</span><span style=3D"c=
olor:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> z</span><spa=
n style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><=
br></span><span style=3D"color:rgb(102,102,0)">};</span><span style=3D"colo=
r:rgb(0,0,0)"><br><br><br></span><span style=3D"color:rgb(102,0,102)">Trian=
gle</span><span style=3D"color:rgb(0,0,0)"> my_tri</span><span style=3D"col=
or:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br><br>my_tri<=
/span><span style=3D"color:rgb(102,102,0)">.</span><span style=3D"color:rgb=
(0,0,0)">rotate</span><span style=3D"color:rgb(102,102,0)">(</span><span st=
yle=3D"color:rgb(0,102,102)">1.0</span><span style=3D"color:rgb(102,102,0)"=
>);</span><span style=3D"color:rgb(0,0,0)"><br>my_tri</span><span style=3D"=
color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">rotate</span=
><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,10=
2,102)">1</span><span style=3D"color:rgb(102,102,0)">);</span><span style=
=3D"color:rgb(0,0,0)"><br></span></div></code></div><div><br></div><div>As =
far as I can tell, concepts will be able to do something different, however=
 I am unsure whether concepts will remind me at compile time, if I failed t=
o provide an implementation to a function that is part of the concept. Or i=
s there at all any static checking of my class when I say it implements a c=
oncept? Could it be used in a templated manner?</div><div><br></div><div>I =
am not a C++ expert, therefore I sometimes fail to see the bigger picture, =
but I definately know that static polymorphism must not be se obscure. I do=
 not know what are the minimal constraints that must be made so that such a=
 feature is implementable in a compiler. I know that the reason why virtual=
 functions cannot be templated is because there is no way to tell ahead of =
time, how many template types will be substituted into the arguements, whic=
h each will need an entry in the vtable. However, once a function is marked=
 for devirtualization, it might as well have been templated. I do not know =
if constraints must be such that I cannot assign a Triangle* to an instance=
 of Geometry*, or whether it must be something else.</div><div><br></div><d=
iv>What do you guys think about this? Am I horridly on the wrong track? Doe=
s any of this make sense? Even if my idea as it is now doesn't make sense, =
is there another form that could be used to define interfaces and implement=
 them in a static manner? I do not feel educated enough to be able to write=
 a full fledged C++ proposal, but I do have the feeling that something is m=
issing from the language.</div></div></blockquote></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 />

------=_Part_461_2729293.1394728201397--

.


Author: Vincent Reverdy <vince.rev@gmail.com>
Date: Fri, 14 Mar 2014 06:56:49 -0700 (PDT)
Raw View
------=_Part_409_10338059.1394805409561
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

It's strange, I would have expected a lot more (intensive) debate/reactions=
=20
on this subject. Maybe not so much people are using this in production code=
=20
or maybe CRTP is considered as very convenient for people who are using=20
static polymorphism...

Le jeudi 13 mars 2014 17:30:01 UTC+1, Vincent Reverdy a =C3=A9crit :
>
> Hi M=C3=A1t=C3=A9,
>
> Oh a link to a SO question of mine. It was some time ago, and in fact (as=
=20
> always), it is just a matter of time before getting use to all these=20
> tricks. At the end, what you consider as akward now, become natural for=
=20
> you. But for sure, it is neither convenient nor intuitive for someone who=
=20
> use standard OO programming. As far as I know, concepts lite will not=20
> simplify CRTP, but I think that reflection can. But the question is not=
=20
> exactly the one of complexity, because even if some CRTP cases remain=20
> complicated (or "non-intuitive") to implement, metaprogrammers will=20
> implement them anyway. The question to ask is: do we want to let the=20
> opportunity to non C++ advanced users to use static polymorphism ? And I =
do=20
> not see any fundamental reason against the simplification of static=20
> polymorphism (but maybe I'm wrong).
>
> The following may be just an enormous mistake, but why not just giving=20
> this meaning to a member specified as "static virtual" ?
>
> Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=A1t=C3=A9 Ferenc Nagy-Egri a =
=C3=A9crit :
>>
>> Since I come across CRTP, and other means of static polymorphism, I have=
=20
>> found that it is the coolest C++'s "feature" of all times. I am looking=
=20
>> towards using CRTP as a means of building an AST and using it to generat=
e=20
>> GPU kernel code. I have most things in my head, but when I did the first=
=20
>> toy case using standard STL back-end, I come across an issue I cannot se=
em=20
>> to resolve, and it seem to be at the core of CRTP. While there are=20
>> solutions, they are all criptic to say the least, or seem completely=20
>> inside-out.
>>
>> For eg. this <http://stackoverflow.com/a/11928661/1476661> problem is a=
=20
>> perfect example of how a workaround to a problem just seems awfully=20
>> unnecessary. Sean Parent's presentation<http://channel9.msdn.com/Events/=
GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil>at Going::Native sho=
ws another problem and another solution, which yet=20
>> again is counter-intuitive if nothing else. Other presentations mentione=
d=20
>> how compiler devs are sweating blood in order to devirtualize functions,=
=20
>> and what magic compilers must do to prove that a function can be=20
>> devirtualized. Why cannot the programmer state it's intent, that the cha=
in=20
>> of inheritance between certain classes will never depend on runtime=20
>> variables and are guaranteed to be deducible at compile time? That way I=
=20
>> could have my interfaces templated too, as I can promise to the compiler=
=20
>> that it will see all of the types that a member function is called with.
>>
>> I would like to say something like:
>>
>> class Geometry
>> {
>> public:
>>
>>     template <typename T> void rotate(T radians);
>> };
>>
>> class Triangle | public Geometry // Note "|" instead of ":"
>> {
>> public:
>>
>>     //CTOR
>>
>>     template <typename T> void rotate(T radians) { /* Use radians to=20
>> rotate coordinates */ }
>>
>> private:
>>
>>     double x, y, z;
>> };
>>
>>
>> Triangle my_tri;
>>
>> my_tri.rotate(1.0);
>> my_tri.rotate(1);
>>
>> As far as I can tell, concepts will be able to do something different,=
=20
>> however I am unsure whether concepts will remind me at compile time, if =
I=20
>> failed to provide an implementation to a function that is part of the=20
>> concept. Or is there at all any static checking of my class when I say i=
t=20
>> implements a concept? Could it be used in a templated manner?
>>
>> I am not a C++ expert, therefore I sometimes fail to see the bigger=20
>> picture, but I definately know that static polymorphism must not be se=
=20
>> obscure. I do not know what are the minimal constraints that must be mad=
e=20
>> so that such a feature is implementable in a compiler. I know that the=
=20
>> reason why virtual functions cannot be templated is because there is no =
way=20
>> to tell ahead of time, how many template types will be substituted into =
the=20
>> arguements, which each will need an entry in the vtable. However, once a=
=20
>> function is marked for devirtualization, it might as well have been=20
>> templated. I do not know if constraints must be such that I cannot assig=
n a=20
>> Triangle* to an instance of Geometry*, or whether it must be something e=
lse.
>>
>> What do you guys think about this? Am I horridly on the wrong track? Doe=
s=20
>> any of this make sense? Even if my idea as it is now doesn't make sense,=
 is=20
>> there another form that could be used to define interfaces and implement=
=20
>> them in a static manner? I do not feel educated enough to be able to wri=
te=20
>> a full fledged C++ proposal, but I do have the feeling that something is=
=20
>> missing from the language.
>>
>

--=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/.

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

<div dir=3D"ltr">It's strange, I would have expected a lot more (intensive)=
 debate/reactions on this subject. Maybe not so much people are using this =
in production code or maybe CRTP is considered as very convenient for peopl=
e who are using static polymorphism...<br><br>Le jeudi 13 mars 2014 17:30:0=
1 UTC+1, Vincent Reverdy a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_quot=
e" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddin=
g-left: 1ex;"><div dir=3D"ltr">Hi M=C3=A1t=C3=A9,<br><br>Oh a link to a SO =
question of mine. It was some time ago, and in fact (as always), it is just=
 a matter of time before getting use to all these tricks. At the end, what =
you consider as akward now, become natural for you. But for sure, it is nei=
ther convenient nor intuitive for someone who use standard OO programming. =
As far as I know, concepts lite will not simplify CRTP, but I think that re=
flection can. But the question is not exactly the one of complexity, becaus=
e even if some CRTP cases remain complicated (or "non-intuitive") to implem=
ent, metaprogrammers will implement them anyway. The question to ask is: do=
 we want to let the opportunity to non C++ advanced users to use static pol=
ymorphism ? And I do not see any fundamental reason against the simplificat=
ion of static polymorphism (but maybe I'm wrong).<br><br>The following may =
be just an enormous mistake, but why not just giving this meaning to a memb=
er specified as "<span style=3D"font-family:courier new,monospace">static v=
irtual</span>" ?<br><br>Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=A1t=C3=
=A9 Ferenc Nagy-Egri a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><div>Since I come across CRTP, and other means of sta=
tic polymorphism, I have found that it is the coolest C++'s "feature" of al=
l times. I am looking towards using CRTP as a means of building an AST and =
using it to generate GPU kernel code. I have most things in my head, but wh=
en I did the first toy case using standard STL back-end, I come across an i=
ssue I cannot seem to resolve, and it seem to be at the core of CRTP. While=
 there are solutions, they are all criptic to say the least, or seem comple=
tely inside-out.</div><div><br></div><div>For eg. <a href=3D"http://stackov=
erflow.com/a/11928661/1476661" target=3D"_blank" onmousedown=3D"this.href=
=3D'http://www.google.com/url?q\75http%3A%2F%2Fstackoverflow.com%2Fa%2F1192=
8661%2F1476661\46sa\75D\46sntz\0751\46usg\75AFQjCNEkKtNP4gv3b8mMQo5Zzp18RJ7=
VZg';return true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75ht=
tp%3A%2F%2Fstackoverflow.com%2Fa%2F11928661%2F1476661\46sa\75D\46sntz\0751\=
46usg\75AFQjCNEkKtNP4gv3b8mMQo5Zzp18RJ7VZg';return true;">this</a> problem =
is a perfect example of how a workaround to a problem just seems awfully un=
necessary. Sean Parent's <a href=3D"http://channel9.msdn.com/Events/GoingNa=
tive/2013/Inheritance-Is-The-Base-Class-of-Evil" target=3D"_blank" onmoused=
own=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fchannel9.msd=
n.com%2FEvents%2FGoingNative%2F2013%2FInheritance-Is-The-Base-Class-of-Evil=
\46sa\75D\46sntz\0751\46usg\75AFQjCNHVlpf_jVIeF8I3kBy0FblJ9lq5gA';return tr=
ue;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fcha=
nnel9.msdn.com%2FEvents%2FGoingNative%2F2013%2FInheritance-Is-The-Base-Clas=
s-of-Evil\46sa\75D\46sntz\0751\46usg\75AFQjCNHVlpf_jVIeF8I3kBy0FblJ9lq5gA';=
return true;">presentation</a> at Going::Native shows another&nbsp;problem =
and another solution, which yet again is counter-intuitive if nothing else.=
 Other presentations mentioned how compiler devs are sweating blood in orde=
r to devirtualize functions, and what magic compilers must do to prove that=
 a function can be devirtualized. Why cannot the programmer state it's inte=
nt, that the chain of inheritance between certain classes will never depend=
 on runtime variables and are guaranteed to be deducible at compile time? T=
hat way I could have my interfaces templated too, as I can promise to the c=
ompiler that it will see all of the types that a member function is called =
with.</div><div><br></div><div>I would like to say something like:</div><di=
v><br></div><div style=3D"border:1px solid rgb(187,187,187);background-colo=
r:rgb(250,250,250)"><code><div><span style=3D"color:rgb(0,0,136)">class</sp=
an><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,=
102)">Geometry</span><span style=3D"color:rgb(0,0,0)"><br></span><span styl=
e=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br></s=
pan><span style=3D"color:rgb(0,0,136)">public</span><span style=3D"color:rg=
b(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"><br><br>&nbsp; &nbsp=
; </span><span style=3D"color:rgb(0,0,136)">template</span><span style=3D"c=
olor:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">&lt;</span><s=
pan style=3D"color:rgb(0,0,136)">typename</span><span style=3D"color:rgb(0,=
0,0)"> T</span><span style=3D"color:rgb(102,102,0)">&gt;</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">void</span=
><span style=3D"color:rgb(0,0,0)"> rotate</span><span style=3D"color:rgb(10=
2,102,0)">(</span><span style=3D"color:rgb(0,0,0)">T radians</span><span st=
yle=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br>=
</span><span style=3D"color:rgb(102,102,0)">};</span><span style=3D"color:r=
gb(0,0,0)"><br><br></span><span style=3D"color:rgb(0,0,136)">class</span><s=
pan style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,102)"=
>Triangle</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"col=
or:rgb(102,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(0,0,136)">public</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(102,0,102)">Geometry</span><span style=3D"c=
olor:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">// Note "|" ins=
tead of ":"</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=
=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br></sp=
an><span style=3D"color:rgb(0,0,136)">public</span><span style=3D"color:rgb=
(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"><br><br>&nbsp; &nbsp;=
 </span><span style=3D"color:rgb(136,0,0)">//CTOR</span><span style=3D"colo=
r:rgb(0,0,0)"><br><br>&nbsp; &nbsp; </span><span style=3D"color:rgb(0,0,136=
)">template</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"c=
olor:rgb(102,102,0)">&lt;</span><span style=3D"color:rgb(0,0,136)">typename=
</span><span style=3D"color:rgb(0,0,0)"> T</span><span style=3D"color:rgb(1=
02,102,0)">&gt;</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> rotate=
</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rg=
b(0,0,0)">T radians</span><span style=3D"color:rgb(102,102,0)">)</span><spa=
n style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(13=
6,0,0)">/* Use radians to rotate coordinates */</span><span style=3D"color:=
rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">}</span><span styl=
e=3D"color:rgb(0,0,0)"><br><br></span><span style=3D"color:rgb(0,0,136)">pr=
ivate</span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"col=
or:rgb(0,0,0)"><br><br>&nbsp; &nbsp; </span><span style=3D"color:rgb(0,0,13=
6)">double</span><span style=3D"color:rgb(0,0,0)"> x</span><span style=3D"c=
olor:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> y</span><spa=
n style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> =
z</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:r=
gb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">};</span><span s=
tyle=3D"color:rgb(0,0,0)"><br><br><br></span><span style=3D"color:rgb(102,0=
,102)">Triangle</span><span style=3D"color:rgb(0,0,0)"> my_tri</span><span =
style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br=
><br>my_tri</span><span style=3D"color:rgb(102,102,0)">.</span><span style=
=3D"color:rgb(0,0,0)">rotate</span><span style=3D"color:rgb(102,102,0)">(</=
span><span style=3D"color:rgb(0,102,102)">1.0</span><span style=3D"color:rg=
b(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br>my_tri</span><s=
pan style=3D"color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)"=
>rotate</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"c=
olor:rgb(0,102,102)">1</span><span style=3D"color:rgb(102,102,0)">);</span>=
<span style=3D"color:rgb(0,0,0)"><br></span></div></code></div><div><br></d=
iv><div>As far as I can tell, concepts will be able to do something differe=
nt, however I am unsure whether concepts will remind me at compile time, if=
 I failed to provide an implementation to a function that is part of the co=
ncept. Or is there at all any static checking of my class when I say it imp=
lements a concept? Could it be used in a templated manner?</div><div><br></=
div><div>I am not a C++ expert, therefore I sometimes fail to see the bigge=
r picture, but I definately know that static polymorphism must not be se ob=
scure. I do not know what are the minimal constraints that must be made so =
that such a feature is implementable in a compiler. I know that the reason =
why virtual functions cannot be templated is because there is no way to tel=
l ahead of time, how many template types will be substituted into the argue=
ments, which each will need an entry in the vtable. However, once a functio=
n is marked for devirtualization, it might as well have been templated. I d=
o not know if constraints must be such that I cannot assign a Triangle* to =
an instance of Geometry*, or whether it must be something else.</div><div><=
br></div><div>What do you guys think about this? Am I horridly on the wrong=
 track? Does any of this make sense? Even if my idea as it is now doesn't m=
ake sense, is there another form that could be used to define interfaces an=
d implement them in a static manner? I do not feel educated enough to be ab=
le to write a full fledged C++ proposal, but I do have the feeling that som=
ething is missing from the language.</div></div></blockquote></div></blockq=
uote></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 />

------=_Part_409_10338059.1394805409561--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 14 Mar 2014 16:02:13 +0200
Raw View
On 14 March 2014 15:56, Vincent Reverdy <vince.rev@gmail.com> wrote:
> It's strange, I would have expected a lot more (intensive) debate/reactions
> on this subject. Maybe not so much people are using this in production code
> or maybe CRTP is considered as very convenient for people who are using
> static polymorphism...


I don't quite grasp what the original thread author is proposing, and
I certainly
don't know what a "static virtual" is supposed to do. I do know that whatever
it's supposed to do, I'm against anything that is "static virtual",
since that combination
makes absolutely no sense to me.

--

---
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/.

.


Author: Vincent Reverdy <vince.rev@gmail.com>
Date: Fri, 14 Mar 2014 07:43:08 -0700 (PDT)
Raw View
------=_Part_213_10199246.1394808188860
Content-Type: text/plain; charset=UTF-8

I am not 100% sure what the OP tries to achieve with his syntax, but I
think that  the "global idea" is to propose a special context in which
"this->" used in a base class would mean the derived class (or anything
equivalent to the static_cast<derived&>(*this) used in CRTP).

--

---
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/.

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

<div dir=3D"ltr">I am not 100% sure what the OP tries to achieve with his s=
yntax, but I think that&nbsp; the "global idea" is to propose a special con=
text in which "this-&gt;" used in a base class would mean the derived class=
 (or anything equivalent to the <span style=3D"font-family: courier new,mon=
ospace;">static_cast&lt;derived&amp;&gt;(*this)</span> used in CRTP).<br><b=
r></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 />

------=_Part_213_10199246.1394808188860--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 14 Mar 2014 16:52:53 +0200
Raw View
On 14 March 2014 16:43, Vincent Reverdy <vince.rev@gmail.com> wrote:
> I am not 100% sure what the OP tries to achieve with his syntax, but I think
> that  the "global idea" is to propose a special context in which "this->"
> used in a base class would mean the derived class (or anything equivalent to
> the static_cast<derived&>(*this) used in CRTP).

Right.

#include <iostream>

template <class T> struct base {
    T* actual = static_cast<T*>(this);
     void g() {actual->f();}
};

struct derived : base<derived> {
    void f() {std::cout << "In derived::f()" << std::endl;}
};

int main() {
    derived d;
    d.g();
}

So, we can already create a data member initialized with the cast, and it works
without any extensions.

--

---
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/.

.


Author: Vincent Reverdy <vince.rev@gmail.com>
Date: Fri, 14 Mar 2014 08:03:21 -0700 (PDT)
Raw View
------=_Part_3090_17588596.1394809401162
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Of course, we can already do that. But I think that the OP want an=20
OO-friendly syntax (I think because [and I don't know why...] templates=20
scare people...).

Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=A1t=C3=A9 Ferenc Nagy-Egri a =C3=
=A9crit :
>
> Since I come across CRTP, and other means of static polymorphism, I have=
=20
> found that it is the coolest C++'s "feature" of all times. I am looking=
=20
> towards using CRTP as a means of building an AST and using it to generate=
=20
> GPU kernel code. I have most things in my head, but when I did the first=
=20
> toy case using standard STL back-end, I come across an issue I cannot see=
m=20
> to resolve, and it seem to be at the core of CRTP. While there are=20
> solutions, they are all criptic to say the least, or seem completely=20
> inside-out.
>
> For eg. this <http://stackoverflow.com/a/11928661/1476661> problem is a=
=20
> perfect example of how a workaround to a problem just seems awfully=20
> unnecessary. Sean Parent's presentation<http://channel9.msdn.com/Events/G=
oingNative/2013/Inheritance-Is-The-Base-Class-of-Evil>at Going::Native show=
s another problem and another solution, which yet=20
> again is counter-intuitive if nothing else. Other presentations mentioned=
=20
> how compiler devs are sweating blood in order to devirtualize functions,=
=20
> and what magic compilers must do to prove that a function can be=20
> devirtualized. Why cannot the programmer state it's intent, that the chai=
n=20
> of inheritance between certain classes will never depend on runtime=20
> variables and are guaranteed to be deducible at compile time? That way I=
=20
> could have my interfaces templated too, as I can promise to the compiler=
=20
> that it will see all of the types that a member function is called with.
>
> I would like to say something like:
>
> class Geometry
> {
> public:
>
>     template <typename T> void rotate(T radians);
> };
>
> class Triangle | public Geometry // Note "|" instead of ":"
> {
> public:
>
>     //CTOR
>
>     template <typename T> void rotate(T radians) { /* Use radians to=20
> rotate coordinates */ }
>
> private:
>
>     double x, y, z;
> };
>
>
> Triangle my_tri;
>
> my_tri.rotate(1.0);
> my_tri.rotate(1);
>
> As far as I can tell, concepts will be able to do something different,=20
> however I am unsure whether concepts will remind me at compile time, if I=
=20
> failed to provide an implementation to a function that is part of the=20
> concept. Or is there at all any static checking of my class when I say it=
=20
> implements a concept? Could it be used in a templated manner?
>
> I am not a C++ expert, therefore I sometimes fail to see the bigger=20
> picture, but I definately know that static polymorphism must not be se=20
> obscure. I do not know what are the minimal constraints that must be made=
=20
> so that such a feature is implementable in a compiler. I know that the=20
> reason why virtual functions cannot be templated is because there is no w=
ay=20
> to tell ahead of time, how many template types will be substituted into t=
he=20
> arguements, which each will need an entry in the vtable. However, once a=
=20
> function is marked for devirtualization, it might as well have been=20
> templated. I do not know if constraints must be such that I cannot assign=
 a=20
> Triangle* to an instance of Geometry*, or whether it must be something el=
se.
>
> What do you guys think about this? Am I horridly on the wrong track? Does=
=20
> any of this make sense? Even if my idea as it is now doesn't make sense, =
is=20
> there another form that could be used to define interfaces and implement=
=20
> them in a static manner? I do not feel educated enough to be able to writ=
e=20
> a full fledged C++ proposal, but I do have the feeling that something is=
=20
> missing from the language.
>

--=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/.

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

<div dir=3D"ltr">Of course, we can already do that. But I think that the OP=
 want an OO-friendly syntax (I think because [and I don't know why...] temp=
lates scare people...).<br><br>Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=
=A1t=C3=A9 Ferenc Nagy-Egri a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;"><div dir=3D"ltr"><div>Since I come across CRTP, and other =
means of static polymorphism, I have found that it is the coolest C++'s "fe=
ature" of all times. I am looking towards using CRTP as a means of building=
 an AST and using it to generate GPU kernel code. I have most things in my =
head, but when I did the first toy case using standard STL back-end, I come=
 across an issue I cannot seem to resolve, and it seem to be at the core of=
 CRTP. While there are solutions, they are all criptic to say the least, or=
 seem completely inside-out.</div><div><br></div><div>For eg. <a href=3D"ht=
tp://stackoverflow.com/a/11928661/1476661" target=3D"_blank" onmousedown=3D=
"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fstackoverflow.com%=
2Fa%2F11928661%2F1476661\46sa\75D\46sntz\0751\46usg\75AFQjCNEkKtNP4gv3b8mMQ=
o5Zzp18RJ7VZg';return true;" onclick=3D"this.href=3D'http://www.google.com/=
url?q\75http%3A%2F%2Fstackoverflow.com%2Fa%2F11928661%2F1476661\46sa\75D\46=
sntz\0751\46usg\75AFQjCNEkKtNP4gv3b8mMQo5Zzp18RJ7VZg';return true;">this</a=
> problem is a perfect example of how a workaround to a problem just seems =
awfully unnecessary. Sean Parent's <a href=3D"http://channel9.msdn.com/Even=
ts/GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil" target=3D"_blank=
" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fch=
annel9.msdn.com%2FEvents%2FGoingNative%2F2013%2FInheritance-Is-The-Base-Cla=
ss-of-Evil\46sa\75D\46sntz\0751\46usg\75AFQjCNHVlpf_jVIeF8I3kBy0FblJ9lq5gA'=
;return true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3=
A%2F%2Fchannel9.msdn.com%2FEvents%2FGoingNative%2F2013%2FInheritance-Is-The=
-Base-Class-of-Evil\46sa\75D\46sntz\0751\46usg\75AFQjCNHVlpf_jVIeF8I3kBy0Fb=
lJ9lq5gA';return true;">presentation</a> at Going::Native shows another&nbs=
p;problem and another solution, which yet again is counter-intuitive if not=
hing else. Other presentations mentioned how compiler devs are sweating blo=
od in order to devirtualize functions, and what magic compilers must do to =
prove that a function can be devirtualized. Why cannot the programmer state=
 it's intent, that the chain of inheritance between certain classes will ne=
ver depend on runtime variables and are guaranteed to be deducible at compi=
le time? That way I could have my interfaces templated too, as I can promis=
e to the compiler that it will see all of the types that a member function =
is called with.</div><div><br></div><div>I would like to say something like=
:</div><div><br></div><div style=3D"border:1px solid rgb(187,187,187);backg=
round-color:rgb(250,250,250)"><code><div><span style=3D"color:rgb(0,0,136)"=
>class</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:=
rgb(102,0,102)">Geometry</span><span style=3D"color:rgb(0,0,0)"><br></span>=
<span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0=
)"><br></span><span style=3D"color:rgb(0,0,136)">public</span><span style=
=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"><br><br>=
&nbsp; &nbsp; </span><span style=3D"color:rgb(0,0,136)">template</span><spa=
n style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">&=
lt;</span><span style=3D"color:rgb(0,0,136)">typename</span><span style=3D"=
color:rgb(0,0,0)"> T</span><span style=3D"color:rgb(102,102,0)">&gt;</span>=
<span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)"=
>void</span><span style=3D"color:rgb(0,0,0)"> rotate</span><span style=3D"c=
olor:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">T radians</sp=
an><span style=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0=
,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">};</span><span style=
=3D"color:rgb(0,0,0)"><br><br></span><span style=3D"color:rgb(0,0,136)">cla=
ss</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(=
102,0,102)">Triangle</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(102,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </s=
pan><span style=3D"color:rgb(0,0,136)">public</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(102,0,102)">Geometry</span><span=
 style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">// N=
ote "|" instead of ":"</span><span style=3D"color:rgb(0,0,0)"><br></span><s=
pan style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"=
><br></span><span style=3D"color:rgb(0,0,136)">public</span><span style=3D"=
color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"><br><br>&nbs=
p; &nbsp; </span><span style=3D"color:rgb(136,0,0)">//CTOR</span><span styl=
e=3D"color:rgb(0,0,0)"><br><br>&nbsp; &nbsp; </span><span style=3D"color:rg=
b(0,0,136)">template</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(102,102,0)">&lt;</span><span style=3D"color:rgb(0,0,136)"=
>typename</span><span style=3D"color:rgb(0,0,0)"> T</span><span style=3D"co=
lor:rgb(102,102,0)">&gt;</span><span style=3D"color:rgb(0,0,0)"> </span><sp=
an style=3D"color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"=
> rotate</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"=
color:rgb(0,0,0)">T radians</span><span style=3D"color:rgb(102,102,0)">)</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,1=
02,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"colo=
r:rgb(136,0,0)">/* Use radians to rotate coordinates */</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">}</span>=
<span style=3D"color:rgb(0,0,0)"><br><br></span><span style=3D"color:rgb(0,=
0,136)">private</span><span style=3D"color:rgb(102,102,0)">:</span><span st=
yle=3D"color:rgb(0,0,0)"><br><br>&nbsp; &nbsp; </span><span style=3D"color:=
rgb(0,0,136)">double</span><span style=3D"color:rgb(0,0,0)"> x</span><span =
style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> y<=
/span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb=
(0,0,0)"> z</span><span style=3D"color:rgb(102,102,0)">;</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">};</s=
pan><span style=3D"color:rgb(0,0,0)"><br><br><br></span><span style=3D"colo=
r:rgb(102,0,102)">Triangle</span><span style=3D"color:rgb(0,0,0)"> my_tri</=
span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(=
0,0,0)"><br><br>my_tri</span><span style=3D"color:rgb(102,102,0)">.</span><=
span style=3D"color:rgb(0,0,0)">rotate</span><span style=3D"color:rgb(102,1=
02,0)">(</span><span style=3D"color:rgb(0,102,102)">1.0</span><span style=
=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br>my_=
tri</span><span style=3D"color:rgb(102,102,0)">.</span><span style=3D"color=
:rgb(0,0,0)">rotate</span><span style=3D"color:rgb(102,102,0)">(</span><spa=
n style=3D"color:rgb(0,102,102)">1</span><span style=3D"color:rgb(102,102,0=
)">);</span><span style=3D"color:rgb(0,0,0)"><br></span></div></code></div>=
<div><br></div><div>As far as I can tell, concepts will be able to do somet=
hing different, however I am unsure whether concepts will remind me at comp=
ile time, if I failed to provide an implementation to a function that is pa=
rt of the concept. Or is there at all any static checking of my class when =
I say it implements a concept? Could it be used in a templated manner?</div=
><div><br></div><div>I am not a C++ expert, therefore I sometimes fail to s=
ee the bigger picture, but I definately know that static polymorphism must =
not be se obscure. I do not know what are the minimal constraints that must=
 be made so that such a feature is implementable in a compiler. I know that=
 the reason why virtual functions cannot be templated is because there is n=
o way to tell ahead of time, how many template types will be substituted in=
to the arguements, which each will need an entry in the vtable. However, on=
ce a function is marked for devirtualization, it might as well have been te=
mplated. I do not know if constraints must be such that I cannot assign a T=
riangle* to an instance of Geometry*, or whether it must be something else.=
</div><div><br></div><div>What do you guys think about this? Am I horridly =
on the wrong track? Does any of this make sense? Even if my idea as it is n=
ow doesn't make sense, is there another form that could be used to define i=
nterfaces and implement them in a static manner? I do not feel educated eno=
ugh to be able to write a full fledged C++ proposal, but I do have the feel=
ing that something is missing from the language.</div></div></blockquote></=
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 />

------=_Part_3090_17588596.1394809401162--

.


Author: =?UTF-8?Q?M=C3=A1t=C3=A9_Ferenc_Nagy-Egri?= <nagymatef@gmail.com>
Date: Fri, 14 Mar 2014 08:42:01 -0700 (PDT)
Raw View
------=_Part_463_27713777.1394811721278
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Templates do not scare me, otherwise I would not have called CRTP a cool=20
feature.

The thing that started me on writing the post was the fact that I am=20
implementing template classes similar to a large row vector, a large column=
=20
vector, and large matrix. Large row and column vectors could be diadic=20
multiplied to result large matrices, and all of these in a templated=20
manner. So

LargeRowVector<double> a;
LargeColumnVector<std::complex<double>> b;

auto c =3D a*b;

Would correctly result in a LargeMatrix containing std::complex<double>=20
elements. During implementing the Expressions, the operator expressions,=20
and the Vector and Matrix classes themselves, one would wish to use=20
typedefs declared once in either in the LargeVector classes, or in=20
Expression, but here the recursiveness of the the CRTP idiom kicks in, and=
=20
it cannot be done. One needs to resort to Traits and things like this,=20
which feels completely unnecessary, but also I have not found a way yet to=
=20
implement is properly. Propagating correct types through CRTP Expression=20
Templates is a nightmare.

Even before coding it came to my mind: why is this so complicated? Static=
=20
Polymorphism is a simple notion. Yet, I am here sweating blood, trying to=
=20
write simple things like this. And I am nowhere at generating kernel code=
=20
yet (although that I feel to be more straight forward ATM, being a seasoned=
=20
OpenCL dev). It is the smart, transparent C++ wrapper objects I cannot seem=
=20
to implement. Ultimately I'd like this set of GPU calculations to be=20
available to those who don't know anything about GPU programming. (And no,=
=20
large vector and matrix is only an example. The thing I am doing is not=20
reinventing the wheel.)




2014. m=C3=A1rcius 14., p=C3=A9ntek 16:03:21 UTC+1 id=C5=91pontban Vincent =
Reverdy a=20
k=C3=B6vetkez=C5=91t =C3=ADrta:

> Of course, we can already do that. But I think that the OP want an=20
> OO-friendly syntax (I think because [and I don't know why...] templates=
=20
> scare people...).
>
> Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=A1t=C3=A9 Ferenc Nagy-Egri a =
=C3=A9crit :
>>
>> Since I come across CRTP, and other means of static polymorphism, I have=
=20
>> found that it is the coolest C++'s "feature" of all times. I am looking=
=20
>> towards using CRTP as a means of building an AST and using it to generat=
e=20
>> GPU kernel code. I have most things in my head, but when I did the first=
=20
>> toy case using standard STL back-end, I come across an issue I cannot se=
em=20
>> to resolve, and it seem to be at the core of CRTP. While there are=20
>> solutions, they are all criptic to say the least, or seem completely=20
>> inside-out.
>>
>> For eg. this <http://stackoverflow.com/a/11928661/1476661> problem is a=
=20
>> perfect example of how a workaround to a problem just seems awfully=20
>> unnecessary. Sean Parent's presentation<http://channel9.msdn.com/Events/=
GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil>at Going::Native sho=
ws another problem and another solution, which yet=20
>> again is counter-intuitive if nothing else. Other presentations mentione=
d=20
>> how compiler devs are sweating blood in order to devirtualize functions,=
=20
>> and what magic compilers must do to prove that a function can be=20
>> devirtualized. Why cannot the programmer state it's intent, that the cha=
in=20
>> of inheritance between certain classes will never depend on runtime=20
>> variables and are guaranteed to be deducible at compile time? That way I=
=20
>> could have my interfaces templated too, as I can promise to the compiler=
=20
>> that it will see all of the types that a member function is called with.
>>
>> I would like to say something like:
>>
>> class Geometry
>> {
>> public:
>>
>>     template <typename T> void rotate(T radians);
>> };
>>
>> class Triangle | public Geometry // Note "|" instead of ":"
>> {
>> public:
>>
>>     //CTOR
>>
>>     template <typename T> void rotate(T radians) { /* Use radians to=20
>> rotate coordinates */ }
>>
>> private:
>>
>>     double x, y, z;
>> };
>>
>>
>> Triangle my_tri;
>>
>> my_tri.rotate(1.0);
>> my_tri.rotate(1);
>>
>> As far as I can tell, concepts will be able to do something different,=
=20
>> however I am unsure whether concepts will remind me at compile time, if =
I=20
>> failed to provide an implementation to a function that is part of the=20
>> concept. Or is there at all any static checking of my class when I say i=
t=20
>> implements a concept? Could it be used in a templated manner?
>>
>> I am not a C++ expert, therefore I sometimes fail to see the bigger=20
>> picture, but I definately know that static polymorphism must not be se=
=20
>> obscure. I do not know what are the minimal constraints that must be mad=
e=20
>> so that such a feature is implementable in a compiler. I know that the=
=20
>> reason why virtual functions cannot be templated is because there is no =
way=20
>> to tell ahead of time, how many template types will be substituted into =
the=20
>> arguements, which each will need an entry in the vtable. However, once a=
=20
>> function is marked for devirtualization, it might as well have been=20
>> templated. I do not know if constraints must be such that I cannot assig=
n a=20
>> Triangle* to an instance of Geometry*, or whether it must be something e=
lse.
>>
>> What do you guys think about this? Am I horridly on the wrong track? Doe=
s=20
>> any of this make sense? Even if my idea as it is now doesn't make sense,=
 is=20
>> there another form that could be used to define interfaces and implement=
=20
>> them in a static manner? I do not feel educated enough to be able to wri=
te=20
>> a full fledged C++ proposal, but I do have the feeling that something is=
=20
>> missing from the language.
>>
>

--=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/.

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

<div dir=3D"ltr"><div>Templates do not scare me, otherwise I would not have=
 called CRTP a cool feature.</div><div><br></div><div>The thing that starte=
d me on writing the post was the fact that I am implementing template class=
es similar to a large row vector, a large column vector, and large matrix. =
Large row and column vectors could be diadic multiplied to result large mat=
rices, and all of these in a templated manner. So</div><div><br></div><div =
class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); border=
-image: none; -ms-word-wrap: break-word; background-color: rgb(250, 250, 25=
0);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 0, 102);">LargeRowVector</=
span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 136, 0);">&l=
t;double&gt;</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0=
, 0, 0);"> a</span><span class=3D"styled-by-prettify" style=3D"color: rgb(1=
02, 102, 0);">;</span><span class=3D"styled-by-prettify" style=3D"color: rg=
b(0, 0, 0);"><br></span><span class=3D"styled-by-prettify" style=3D"color: =
rgb(102, 0, 102);">LargeColumnVector</span><span class=3D"styled-by-prettif=
y" style=3D"color: rgb(102, 102, 0);">&lt;</span><span class=3D"styled-by-p=
rettify" style=3D"color: rgb(0, 0, 0);">std</span><span class=3D"styled-by-=
prettify" style=3D"color: rgb(102, 102, 0);">::</span><span class=3D"styled=
-by-prettify" style=3D"color: rgb(0, 0, 0);">complex</span><span class=3D"s=
tyled-by-prettify" style=3D"color: rgb(0, 136, 0);">&lt;double&gt;</span><s=
pan class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&gt;</s=
pan><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> b</s=
pan><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">;=
</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><b=
r><br></span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 1=
36);">auto</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, =
0, 0);"> c </span><span class=3D"styled-by-prettify" style=3D"color: rgb(10=
2, 102, 0);">=3D</span><span class=3D"styled-by-prettify" style=3D"color: r=
gb(0, 0, 0);"> a</span><span class=3D"styled-by-prettify" style=3D"color: r=
gb(102, 102, 0);">*</span><span class=3D"styled-by-prettify" style=3D"color=
: rgb(0, 0, 0);">b</span><span class=3D"styled-by-prettify" style=3D"color:=
 rgb(102, 102, 0);">;</span><span class=3D"styled-by-prettify" style=3D"col=
or: rgb(0, 0, 0);"><br></span></div></code></div><div><br></div><div>Would =
correctly result in a LargeMatrix containing std::complex&lt;double&gt; ele=
ments. During implementing the Expressions, the operator expressions, and t=
he Vector and Matrix classes themselves, one would wish to use typedefs dec=
lared once in either in the LargeVector classes, or in Expression, but here=
 the recursiveness of the the CRTP idiom kicks in, and it cannot be done. O=
ne needs to resort to Traits and things like this, which feels completely u=
nnecessary, but also I have not found a way yet to implement is properly. P=
ropagating correct types through CRTP Expression Templates is a nightmare.<=
/div><div><br></div><div>Even before coding it came to my mind: why is this=
 so complicated? Static Polymorphism is a simple notion. Yet, I am here swe=
ating blood, trying to write simple things like this. And I am nowhere at g=
enerating kernel code yet (although that I feel to be more straight forward=
 ATM, being a seasoned OpenCL dev). It is the smart, transparent C++ wrappe=
r objects I cannot seem to implement. Ultimately I'd like this set of GPU c=
alculations to be available to those who don't know anything about GPU prog=
ramming. (And no, large vector and matrix is only an example. The thing I a=
m doing is not reinventing the wheel.)</div><div><br></div><div><br><br><br=
>2014. m=C3=A1rcius 14., p=C3=A9ntek 16:03:21 UTC+1 id=C5=91pontban Vincent=
 Reverdy a k=C3=B6vetkez=C5=91t =C3=ADrta:</div><blockquote class=3D"gmail_=
quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-c=
olor: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;=
"><div dir=3D"ltr">Of course, we can already do that. But I think that the =
OP want an OO-friendly syntax (I think because [and I don't know why...] te=
mplates scare people...).<br><br>Le jeudi 13 mars 2014 16:23:59 UTC+1, M=C3=
=A1t=C3=A9 Ferenc Nagy-Egri a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_q=
uote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-co=
lor: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"=
><div dir=3D"ltr"><div>Since I come across CRTP, and other means of static =
polymorphism, I have found that it is the coolest C++'s "feature" of all ti=
mes. I am looking towards using CRTP as a means of building an AST and usin=
g it to generate GPU kernel code. I have most things in my head, but when I=
 did the first toy case using standard STL back-end, I come across an issue=
 I cannot seem to resolve, and it seem to be at the core of CRTP. While the=
re are solutions, they are all criptic to say the least, or seem completely=
 inside-out.</div><div><br></div><div>For eg. <a onmousedown=3D"this.href=
=3D'http://www.google.com/url?q\75http%3A%2F%2Fstackoverflow.com%2Fa%2F1192=
8661%2F1476661\46sa\75D\46sntz\0751\46usg\75AFQjCNEkKtNP4gv3b8mMQo5Zzp18RJ7=
VZg';return true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75ht=
tp%3A%2F%2Fstackoverflow.com%2Fa%2F11928661%2F1476661\46sa\75D\46sntz\0751\=
46usg\75AFQjCNEkKtNP4gv3b8mMQo5Zzp18RJ7VZg';return true;" href=3D"http://st=
ackoverflow.com/a/11928661/1476661" target=3D"_blank">this</a> problem is a=
 perfect example of how a workaround to a problem just seems awfully unnece=
ssary. Sean Parent's <a onmousedown=3D"this.href=3D'http://www.google.com/u=
rl?q\75http%3A%2F%2Fchannel9.msdn.com%2FEvents%2FGoingNative%2F2013%2FInher=
itance-Is-The-Base-Class-of-Evil\46sa\75D\46sntz\0751\46usg\75AFQjCNHVlpf_j=
VIeF8I3kBy0FblJ9lq5gA';return true;" onclick=3D"this.href=3D'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fchannel9.msdn.com%2FEvents%2FGoingNative%2F201=
3%2FInheritance-Is-The-Base-Class-of-Evil\46sa\75D\46sntz\0751\46usg\75AFQj=
CNHVlpf_jVIeF8I3kBy0FblJ9lq5gA';return true;" href=3D"http://channel9.msdn.=
com/Events/GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil" target=
=3D"_blank">presentation</a> at Going::Native shows another&nbsp;problem an=
d another solution, which yet again is counter-intuitive if nothing else. O=
ther presentations mentioned how compiler devs are sweating blood in order =
to devirtualize functions, and what magic compilers must do to prove that a=
 function can be devirtualized. Why cannot the programmer state it's intent=
, that the chain of inheritance between certain classes will never depend o=
n runtime variables and are guaranteed to be deducible at compile time? Tha=
t way I could have my interfaces templated too, as I can promise to the com=
piler that it will see all of the types that a member function is called wi=
th.</div><div><br></div><div>I would like to say something like:</div><div>=
<br></div><div style=3D"border: 1px solid rgb(187, 187, 187); border-image:=
 none; background-color: rgb(250, 250, 250);"><code><div><span style=3D"col=
or: rgb(0, 0, 136);">class</span><span style=3D"color: rgb(0, 0, 0);"> </sp=
an><span style=3D"color: rgb(102, 0, 102);">Geometry</span><span style=3D"c=
olor: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 102, 0);">{<=
/span><span style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color:=
 rgb(0, 0, 136);">public</span><span style=3D"color: rgb(102, 102, 0);">:</=
span><span style=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><spa=
n style=3D"color: rgb(0, 0, 136);">template</span><span style=3D"color: rgb=
(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><sp=
an style=3D"color: rgb(0, 0, 136);">typename</span><span style=3D"color: rg=
b(0, 0, 0);"> T</span><span style=3D"color: rgb(102, 102, 0);">&gt;</span><=
span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0,=
 136);">void</span><span style=3D"color: rgb(0, 0, 0);"> rotate</span><span=
 style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0,=
 0);">T radians</span><span style=3D"color: rgb(102, 102, 0);">);</span><sp=
an style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102,=
 102, 0);">};</span><span style=3D"color: rgb(0, 0, 0);"><br><br></span><sp=
an style=3D"color: rgb(0, 0, 136);">class</span><span style=3D"color: rgb(0=
, 0, 0);"> </span><span style=3D"color: rgb(102, 0, 102);">Triangle</span><=
span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, =
102, 0);">|</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 0, 136);">public</span><span style=3D"color: rgb(0, 0, 0)=
;"> </span><span style=3D"color: rgb(102, 0, 102);">Geometry</span><span st=
yle=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);"=
>// Note "|" instead of ":"</span><span style=3D"color: rgb(0, 0, 0);"><br>=
</span><span style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"colo=
r: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(0, 0, 136);">public<=
/span><span style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color=
: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><span style=3D"color: rgb(136=
, 0, 0);">//CTOR</span><span style=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; =
&nbsp; </span><span style=3D"color: rgb(0, 0, 136);">template</span><span s=
tyle=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0=
);">&lt;</span><span style=3D"color: rgb(0, 0, 136);">typename</span><span =
style=3D"color: rgb(0, 0, 0);"> T</span><span style=3D"color: rgb(102, 102,=
 0);">&gt;</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 0, 136);">void</span><span style=3D"color: rgb(0, 0, 0);"=
> rotate</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=
=3D"color: rgb(0, 0, 0);">T radians</span><span style=3D"color: rgb(102, 10=
2, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D=
"color: rgb(102, 102, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"> </=
span><span style=3D"color: rgb(136, 0, 0);">/* Use radians to rotate coordi=
nates */</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"=
color: rgb(102, 102, 0);">}</span><span style=3D"color: rgb(0, 0, 0);"><br>=
<br></span><span style=3D"color: rgb(0, 0, 136);">private</span><span style=
=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color: rgb(0, 0, 0);">=
<br><br>&nbsp; &nbsp; </span><span style=3D"color: rgb(0, 0, 136);">double<=
/span><span style=3D"color: rgb(0, 0, 0);"> x</span><span style=3D"color: r=
gb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> y</span><sp=
an style=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, =
0, 0);"> z</span><span style=3D"color: rgb(102, 102, 0);">;</span><span sty=
le=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 102, =
0);">};</span><span style=3D"color: rgb(0, 0, 0);"><br><br><br></span><span=
 style=3D"color: rgb(102, 0, 102);">Triangle</span><span style=3D"color: rg=
b(0, 0, 0);"> my_tri</span><span style=3D"color: rgb(102, 102, 0);">;</span=
><span style=3D"color: rgb(0, 0, 0);"><br><br>my_tri</span><span style=3D"c=
olor: rgb(102, 102, 0);">.</span><span style=3D"color: rgb(0, 0, 0);">rotat=
e</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"col=
or: rgb(0, 102, 102);">1.0</span><span style=3D"color: rgb(102, 102, 0);">)=
;</span><span style=3D"color: rgb(0, 0, 0);"><br>my_tri</span><span style=
=3D"color: rgb(102, 102, 0);">.</span><span style=3D"color: rgb(0, 0, 0);">=
rotate</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=
=3D"color: rgb(0, 102, 102);">1</span><span style=3D"color: rgb(102, 102, 0=
);">);</span><span style=3D"color: rgb(0, 0, 0);"><br></span></div></code><=
/div><div><br></div><div>As far as I can tell, concepts will be able to do =
something different, however I am unsure whether concepts will remind me at=
 compile time, if I failed to provide an implementation to a function that =
is part of the concept. Or is there at all any static checking of my class =
when I say it implements a concept? Could it be used in a templated manner?=
</div><div><br></div><div>I am not a C++ expert, therefore I sometimes fail=
 to see the bigger picture, but I definately know that static polymorphism =
must not be se obscure. I do not know what are the minimal constraints that=
 must be made so that such a feature is implementable in a compiler. I know=
 that the reason why virtual functions cannot be templated is because there=
 is no way to tell ahead of time, how many template types will be substitut=
ed into the arguements, which each will need an entry in the vtable. Howeve=
r, once a function is marked for devirtualization, it might as well have be=
en templated. I do not know if constraints must be such that I cannot assig=
n a Triangle* to an instance of Geometry*, or whether it must be something =
else.</div><div><br></div><div>What do you guys think about this? Am I horr=
idly on the wrong track? Does any of this make sense? Even if my idea as it=
 is now doesn't make sense, is there another form that could be used to def=
ine interfaces and implement them in a static manner? I do not feel educate=
d enough to be able to write a full fledged C++ proposal, but I do have the=
 feeling that something is missing from the language.</div></div></blockquo=
te></div></blockquote></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 />

------=_Part_463_27713777.1394811721278--

.


Author: Cleiton Santoia <cleitonsantoia@gmail.com>
Date: Fri, 14 Mar 2014 13:52:18 -0700 (PDT)
Raw View
------=_Part_3221_6390407.1394830338846
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable


Hello M=C3=A1t=C3=A9, let=C2=B4s try piesce by piesce

Em quinta-feira, 13 de mar=C3=A7o de 2014 12h23min59s UTC-3, M=C3=A1t=C3=A9=
 Ferenc=20
Nagy-Egri escreveu:
>
> Why cannot the programmer state it's intent, that the chain of inheritanc=
e=20
> between certain classes will never depend on runtime variables and are=20
> guaranteed to be deducible at compile time?=20
>

That=C2=B4s confusing to me:=20

Looking at your code appear to me that you are trying this :

class Geometry {
                         void rotate(T radians) =3D 0; // ok, pure virtual=
=20
must be implemented in all concrete derived=20
   template <typename T> void rotate_multi_typed(T radians) =3D 0; // nop..=
..=20
error
};

Sorry, but that is illegal.=20

1 - If you say that "chain of inheritance will not depend on run-time", may=
=20
be it means that the class should not be inherited ( they don=C2=B4t have=
=20
dependencies );
2 - If you want to state to the compiler that you can guarantee to be=20
deduced at compile time it may means that they are 'constexpr' or=20
non-virtual functions;
3 - Every time you need to define (or redefine) the behavior of function in=
=20
a derived class, it happens (mostly) because that function must be virtual,=
=20
and you will use it by calling from a parent class. Let's say you have a=20
"std::vector<Geometry*> g_", you will call "rotate" on all elements of g_,=
=20
in this case the "chain of inheritance TOTALLY WILL depend on run-time", ok=
=20
?

As far as I can tell, concepts will be able to do something different,=20
> however I am unsure whether concepts will remind me at compile time, if I=
=20
> failed to provide an implementation to a function that is part of the=20
> concept. Or is there at all any static checking of my class when I say it=
=20
> implements a concept? Could it be used in a templated manner?
>

When you use a template class of function as "template<class T> void foo(T=
=20
t) { t.do_something(); }" you don=C2=B4t need to tell the compiler that T m=
ust=20
have "do_something()" method or any other characteristic of T, because for=
=20
every call of foo, and each parameter you pass, the compiler will figures=
=20
out by itself if the type you passed have "do_something()" or not, and if=
=20
it does ok, if not, you got a compiler error.=20

And about concepts, they are not like "generic bounds" from java, they are=
=20
simpler and much more powerful, you can see them as=20
"bool constexpr functions", that the compiler will run and check if true=20
before compile the template. And yes "conceptually", you can understand=20
them as restrictions over parameter types of a template.
=20

> I am not a C++ expert, therefore I sometimes fail to see the bigger=20
> picture, but I definitely know that static polymorphism must not be se=20
> obscure. I do not know what are the minimal constraints that must be made=
=20
> so that such a feature is implementable in a compiler. I know that the=20
> reason why virtual functions cannot be templated is because there is no w=
ay=20
> to tell ahead of time, how many template types will be substituted into t=
he=20
> arguements, which each will need an entry in the vtable. However, once a=
=20
> function is marked for devirtualization, it might as well have been=20
> templated. I do not know if constraints must be such that I cannot assign=
 a=20
> Triangle* to an instance of Geometry*, or whether it must be something el=
se.
>

I=C2=B4m not sure about what is "the big picture" you are saying, but most =
"big=20
picture" I have is that template programming allowed C++ to set containers=
=20
libraries separated from algorithms libraries, and there is no "base class"=
=20
of containers or "base class" of algorithms, may be you can think by=20
yourself on how you can design "container of geometric" in one lib and=20
"Rotate/Fit/Stretch" algorithms in other lib, in the way you can use apply=
=20
freely any algorithm on any "geometric" without need to implement each=20
algorithm inside the shapes;

--=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/.

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

<div dir=3D"ltr"><div><br></div>Hello&nbsp;<span style=3D"white-space: nowr=
ap;">M=C3=A1t=C3=A9, let=C2=B4s try piesce by piesce</span><br><br>Em quint=
a-feira, 13 de mar=C3=A7o de 2014 12h23min59s UTC-3, M=C3=A1t=C3=A9 Ferenc =
Nagy-Egri  escreveu:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><div>Why cannot the programmer state it's intent, that the chain o=
f inheritance between certain classes will never depend on runtime variable=
s and are guaranteed to be deducible at compile time? </div></div></blockqu=
ote><div><br></div><div>That=C2=B4s confusing to me:&nbsp;</div><div><br></=
div><div>Looking at your code appear to me that you are trying this :<br></=
div><div><br></div><div><div class=3D"prettyprint" style=3D"background-colo=
r: rgb(250, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: bre=
ak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">Geometry</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbs=
p; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style=3D"color: rgb(0, 0,=
 136);"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</spa=
n></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> rotate<=
/span><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">(</span></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">T radians</span><span style=3D"color: rgb(102, =
102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #0=
66;" class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">// ok, pure virtual must be implemented in all concrete derived </sp=
an></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp;</span><span style=3D"color: rgb(0, 0, 136);"><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">template</span></span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: rgb(0, =
0, 136);"><span style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: rgb(0, 0, 136);"><span style=3D"color: #008;" class=3D"styled=
-by-prettify">void</span></span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> rotate_multi_typed</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">T radians</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" =
class=3D"styled-by-prettify">// nop... error</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span></div></code></div><br>Sorry, but that is il=
legal.&nbsp;</div><div><br></div><div><div>1 - If you say that "chain of in=
heritance will not depend on run-time", may be it means that the class shou=
ld not be inherited ( they don=C2=B4t have dependencies );</div><div>2 - If=
 you want to state to the compiler that you can guarantee to be deduced at =
compile time it may means that they are 'constexpr' or non-virtual function=
s;</div><div>3 - Every time you need to define (or redefine) the behavior o=
f function in a derived class, it happens (mostly) because that function mu=
st be virtual, and you will use it by calling from a parent class. Let's sa=
y you have a "std::vector&lt;Geometry*&gt;&nbsp;g_", you will call "rotate"=
 on all elements of g_, in this case the "chain of inheritance TOTALLY WILL=
 depend on run-time", ok ?<br></div></div><div><br></div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><div>As far as I can tell, con=
cepts will be able to do something different, however I am unsure whether c=
oncepts will remind me at compile time, if I failed to provide an implement=
ation to a function that is part of the concept. Or is there at all any sta=
tic checking of my class when I say it implements a concept? Could it be us=
ed in a templated manner?</div></div></blockquote><div><br></div><div>When =
you use a template class of function as "template&lt;class T&gt; void foo(T=
 t) { t.do_something(); }" you don=C2=B4t need to tell the compiler that T =
must have "do_something()" method or any other characteristic of T, because=
 for every call of foo, and each parameter you pass, the compiler will figu=
res out by itself if the type you passed have "do_something()" or not, and =
if it does ok, if not, you got a compiler error.&nbsp;</div><div><br></div>=
<div>And about concepts, they are not like "generic bounds" from java, they=
 are simpler and much more powerful, you can see them as "bool&nbsp;constex=
pr&nbsp;functions", that the compiler will run and check if true before com=
pile the template. And yes "conceptually", you can understand them as restr=
ictions over parameter types of a template.</div><div>&nbsp;</div><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>I am not a C++ ex=
pert, therefore I sometimes fail to see the bigger picture, but I definitel=
y know that static polymorphism must not be se obscure. I do not know what =
are the minimal constraints that must be made so that such a feature is imp=
lementable in a compiler. I know that the reason why virtual functions cann=
ot be templated is because there is no way to tell ahead of time, how many =
template types will be substituted into the arguements, which each will nee=
d an entry in the vtable. However, once a function is marked for devirtuali=
zation, it might as well have been templated. I do not know if constraints =
must be such that I cannot assign a Triangle* to an instance of Geometry*, =
or whether it must be something else.<br></div></div></blockquote><div><br>=
</div><div>I=C2=B4m not sure about what is "the big picture" you are saying=
, but most "big picture"&nbsp;I have is that template programming allowed C=
++ to set containers libraries separated from algorithms libraries, and the=
re is no "base class" of containers or "base class" of algorithms, may be y=
ou can think by yourself on how you can design "container of&nbsp;geometric=
"&nbsp;in one lib and "Rotate/Fit/Stretch" algorithms in other lib, in the =
way you can use apply freely any algorithm on any "geometric" without need =
to implement each algorithm inside&nbsp;the shapes;</div><div><br></div></d=
iv>

<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 />

------=_Part_3221_6390407.1394830338846--

.


Author: =?UTF-8?Q?M=C3=A1t=C3=A9_Ferenc_Nagy-Egri?= <nagymatef@gmail.com>
Date: Thu, 24 Apr 2014 02:57:55 -0700 (PDT)
Raw View
------=_Part_126_7065430.1398333476014
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



2014. m=C3=A1rcius 14., p=C3=A9ntek 16:03:21 UTC+1 id=C5=91pontban Vincent =
Reverdy a=20
k=C3=B6vetkez=C5=91t =C3=ADrta:
>
> Of course, we can already do that. But I think that the OP want an=20
> OO-friendly syntax (I think because [and I don't know why...] templates=
=20
> scare people...).
>
>>
>>
Sorry for the long intermezzo, but I got caught up with heaps of things to=
=20
attend.

Vincent and  Ville,

you are correct that I am looking for a means to facilitate CRTP (and=20
presumably other use cases). When you say, that "*At the end, what you=20
consider as akward now, become natural for you*" it is true that these=20
things in time become natural. However C++ is compilcated already as it is.=
=20
I believe introducing this "special type of context" where this-> means=20
something else, is simplifying the language, because it gives proper,=20
intuitive syntax to something that people are doing anyways. Plus, both run=
=20
speed and compilation times would benefit if the programmer could state=20
his/her intent properly (reduced code, no virtual calls when=20
unnecessary...).

The question you asked earlier, whether we want to let less seasoned=20
programmers access static polymorphism, I say: why not? It's not a=20
difficult concept, and the syntax need not be obscure either (for eg. my=20
proposal seems clean enough). Template metaprogrammers can and will do CRTP=
=20
when needed, but just think about it... even the first version of C++ was=
=20
Turing Complete. Practically everything beyond this point is syntactic=20
sugar. So why are there new language versions? Because ultimately we want a=
=20
language that is easier to use, and in which the programmer can express=20
him/herself in the briefest way possible.

I was just saying, I think this is a point where the language could use a=
=20
little facelift. Beer won't be any cheaper from Static Polymorphism, but=20
some people's lives would become easier.

--=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/.

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

<div dir=3D"ltr"><br><br>2014. m=C3=A1rcius 14., p=C3=A9ntek 16:03:21 UTC+1=
 id=C5=91pontban Vincent Reverdy a k=C3=B6vetkez=C5=91t =C3=ADrta:<blockquo=
te class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: =
1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-=
left-style: solid;"><div dir=3D"ltr">Of course, we can already do that. But=
 I think that the OP want an OO-friendly syntax (I think because [and I don=
't know why...] templates scare people...).<br><blockquote class=3D"gmail_q=
uote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-co=
lor: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"=
><div dir=3D"ltr"><div><br></div></div></blockquote></div></blockquote><div=
><br></div><div>Sorry for the long intermezzo, but I got caught up with hea=
ps of things to attend.</div><div><br></div><div>Vincent and &nbsp;Ville,</=
div><div><br></div><div>you are correct that I am looking for a means to fa=
cilitate CRTP (and presumably other use cases). When you say, that "<em>At =
the end, what you consider as akward now, become natural for you</em>" it i=
s true that these things in time become natural. However C++ is compilcated=
 already as it is. I believe introducing this "special type of context" whe=
re this-&gt; means something else, is simplifying the language, because it =
gives proper, intuitive syntax to something that people are doing anyways. =
Plus, both run speed and compilation times would benefit if the programmer =
could state his/her intent properly (reduced code, no virtual calls when un=
necessary...).</div><div><br></div><div>The question you asked earlier, whe=
ther we want to let less seasoned programmers access static polymorphism, I=
 say: why not? It's not a difficult concept, and the syntax need not be obs=
cure either (for eg. my proposal seems clean enough). Template metaprogramm=
ers can and will do CRTP when needed, but just think about it... even the f=
irst version of C++ was Turing Complete. Practically everything beyond this=
 point is syntactic sugar. So why are there new language versions? Because =
ultimately we want a language that is easier to use, and in which the progr=
ammer can express him/herself in the briefest way possible.</div><div><br><=
/div><div>I was just saying, I think this is a point where the language cou=
ld use a little facelift. Beer won't be any cheaper from Static Polymorphis=
m, but some people's lives would become easier.</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 />

------=_Part_126_7065430.1398333476014--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 24 Apr 2014 13:06:19 +0300
Raw View
On 24 April 2014 12:57, M=C3=A1t=C3=A9 Ferenc Nagy-Egri <nagymatef@gmail.co=
m> wrote:
> in time become natural. However C++ is compilcated already as it is. I
> believe introducing this "special type of context" where this-> means
> something else, is simplifying the language, because it gives proper,
> intuitive syntax to something that people are doing anyways. Plus, both r=
un

It's certainly going to complicate all of the specification, implementation=
 and
the learning curve of the language if this-> starts having multiple meaning=
s.
I fail to see why we'd do that when the work-around I showed works fine.

--=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/.

.


Author: =?UTF-8?Q?M=C3=A1t=C3=A9_Ferenc_Nagy-Egri?= <nagymatef@gmail.com>
Date: Thu, 24 Apr 2014 05:06:48 -0700 (PDT)
Raw View
It would only complicate the specs once it is used inside the STL. Plus, I fail to se how a workaround is easier to learn/read than the actual feature. The learning curve of C++ is also steepened by all the workarounds one has to wrap their mind around.

--

---
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/.

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 24 Apr 2014 15:11:07 +0300
Raw View
On 24 April 2014 15:06, M=C3=A1t=C3=A9 Ferenc Nagy-Egri <nagymatef@gmail.co=
m> wrote:
> It would only complicate the specs once it is used inside the STL. Plus, =
I fail to se

It will complicate the specification the moment it enters a working
draft, regardless
of whether it's used "inside the STL". It will also incur additional
work for implementation
vendors. With those aspects in mind, we need to ask whether we really
need a language
change to get the functionality we want. If it's just being able to
avoid boiler-plate
static_casts to T* from Base<T>* (this), the answer is no.

>how a workaround is easier to learn/read than the actual feature. The lear=
ning curve of C++ is also steepened by all the

Perhaps because it's not a work-around in the very sense of the word.
It's implementing
the desired functionality with existing language facilities, without
adding a new language
facility for everything people come up with.

--=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/.

.


Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Thu, 24 Apr 2014 10:13:42 -0400
Raw View
--001a1134effcd711a004f7ca74e2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Sorry, M=C3=A1t=C3=A9, can you extend the code you are presenting? is it av=
ailable
anywhere? Can your provide a more complete toy example? I am not sure I
understand the form of your solution to the briefly described
vector/matrix, where CRTP is/cannot be used and why and how the equivalent
syntax with traits would be. Having a more complete description of the
problem and the forms of the solutions might help determining whether a
change in this direction is just aesthetic or really simplifies the life of
developers. Lambdas don't really enable anything, but it simplifies code to
enough people that they are well worth the added complexity.

On Fri, Mar 14, 2014 at 11:42 AM, M=C3=A1t=C3=A9 Ferenc Nagy-Egri <nagymate=
f@gmail.com
> wrote:

> Even before coding it came to my mind: why is this so complicated? Static
> Polymorphism is a simple notion. Yet, I am here sweating blood, trying to
> write simple things like this.
>

You have to match the simple concept of static polymorphism with type
safety and the compilation model (top-down). If I understood your
intention, you want to mark a signature as not present in the base,
allowing code in the base to use that function (would this extend to access
to data members?) and force a complete object to provide the definition.
Lookup when processing the base would find this and resolve it to the
definition in the derived type (or types, think multiple inheritance).

While you might consider that this does not add a bunch of complexity, it
implies a complete shift in the paradigm. Currently the compiler works on
the opposite direction: processing of the derived type depends *only* on
the bases, now the dependency becomes cyclic: the derived type depends on
the base which depends on the derived type itself. This, even if only at a
conceptual level is adding a good amount of complexity to the language that
would need to be specified, implemented and learned by *all* programmers to
the benefit of the few (this is a random guess, but without complete
understanding of your whole issue it seems that this would not be widely
used).

Again, a more complete motivating example might help share your point of
view.

    David

--=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/.

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

<div dir=3D"ltr">Sorry, M=C3=A1t=C3=A9, can you extend the code you are pre=
senting? is it available anywhere? Can your provide a more complete toy exa=
mple? I am not sure I understand the form of your solution to the briefly d=
escribed vector/matrix, where CRTP is/cannot be used and why and how the eq=
uivalent syntax with traits would be. Having a more complete description of=
 the problem and the forms of the solutions might help determining whether =
a change in this direction is just aesthetic or really simplifies the life =
of developers. Lambdas don&#39;t really enable anything, but it simplifies =
code to enough people that they are well worth the added complexity.<br>
<div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, Mar 14, 2=
014 at 11:42 AM, M=C3=A1t=C3=A9 Ferenc Nagy-Egri <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:nagymatef@gmail.com" target=3D"_blank">nagymatef@gmail.com</a=
>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Even before coding it =
came to my mind: why is this so complicated? Static Polymorphism is a simpl=
e notion. Yet, I am here sweating blood, trying to write simple things like=
 this. </div>
</div></blockquote><div><br>You have to match the simple concept of static =
polymorphism with type safety and the compilation model (top-down). If I un=
derstood your intention, you want to mark a signature as not present in the=
 base, allowing code in the base to use that function (would this extend to=
 access to data members?) and force a complete object to provide the defini=
tion. Lookup when processing the base would find this and resolve it to the=
 definition in the derived type (or types, think multiple inheritance).<br>
<br>While you might consider that this does not add a bunch of complexity, =
it implies a complete shift in the paradigm. Currently the compiler works o=
n the opposite direction: processing of the derived type depends *only* on =
the bases, now the dependency becomes cyclic: the derived type depends on t=
he base which depends on the derived type itself. This, even if only at a c=
onceptual level is adding a good amount of complexity to the language that =
would need to be specified, implemented and learned by *all* programmers to=
 the benefit of the few (this is a random guess, but without complete under=
standing of your whole issue it seems that this would not be widely used).<=
br>
<br>Again, a more complete motivating example might help share your point o=
f view.<br><br>=C2=A0 =C2=A0 David</div></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 />

--001a1134effcd711a004f7ca74e2--

.


Author: rouslankorneychuk@gmail.com
Date: Thu, 24 Apr 2014 23:05:20 -0700 (PDT)
Raw View
------=_Part_297_15926149.1398405920619
Content-Type: text/plain; charset=UTF-8

It should be noted that there was an earlier thread about "mixins":

https://groups.google.com/a/isocpp.org/forum/?fromgroups#!topic/std-proposals/tuYkpJqCKDA

with the same idea.

--

---
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/.

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

<div dir=3D"ltr">It should be noted that there was an earlier thread about =
"mixins":<br><br><a href=3D"https://groups.google.com/a/isocpp.org/forum/?f=
romgroups#!topic/std-proposals/tuYkpJqCKDA">https://groups.google.com/a/iso=
cpp.org/forum/?fromgroups#!topic/std-proposals/tuYkpJqCKDA</a><br><br>with =
the same idea.<br></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 />

------=_Part_297_15926149.1398405920619--

.