Topic: [c++std-core-27246] An implementation of
Author: John Spicer <jhs@edg.com>
Date: Fri, 6 Mar 2015 15:58:00 -0500
Raw View
--Apple-Mail=_3407F964-A294-4C8B-8025-C02959B18F79
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
I think the confusion is that Herb wrote:
>> =E2=80=9Cif the declaration mentions =E2=80=98auto=E2=80=99 or a concept=
name, the compiler needs the definition, either to deduce something or to =
inline the body into the caller.=E2=80=9D Right?
If you say "auto" or a concept name, it is a template. My interpretation =
of what Herb wrote, is that it was implying more than that.
john.
On Mar 6, 2015, at 3:53 PM, Herb Sutter <hsutter@microsoft.com> wrote:
> This surprised me so I asked John offline what he meant, and I think we=
=E2=80=99re not in disagreement. You can=E2=80=99t call those unless there =
are (also) definitions.
> =20
> What I said is correct: If auto (or a concept name) is used in the return=
type or parameter type, the definition must be available =E2=80=9Cin a hea=
der.=E2=80=9D And this is already true for auto return types.
> =20
> I did not mean to imply that you couldn=E2=80=99t also have a forward dec=
laration too (which you can have for function templates but not for auto re=
turns), but it still must be accompanied by a definition which was the poin=
t under discussion, namely that the definition still has to be available in=
the header.
> =20
> Note that I=E2=80=99m excluding the =E2=80=9Cextern template=E2=80=9D cas=
e, which is a special case and about controlling where instantiations occur=
(or limiting them) rather than about writing the generally usable function=
template itself=E2=80=A6 so IMO extern templates aren=E2=80=99t applicable=
to this question.
> =20
> Herb
> =20
> =20
> From: John Spicer [mailto:jhs@edg.com]=20
> Sent: Friday, March 6, 2015 10:38 AM
> To: c++std-core@accu.org
> Cc: Nicol Bolas; std-discussion@isocpp.org; std-proposals@isocpp.org; fai=
salv@gmail.com
> Subject: [c++std-core-27231] Re: An implementation of enhanced auto deduc=
tion and abbreviated template syntax using Clang
> =20
> =20
> On Mar 6, 2015, at 1:27 PM, Herb Sutter <hsutter@microsoft.com> wrote:
>=20
>=20
> > To the novice C++ programmer, it isn't "all just programming." Whether =
something is a template matters.
> =20
> Why? Only because of where you put the definition, and that=E2=80=99s (a)=
teachable and (b) not new because the same issue exists already with:
> =20
> auto f() { =E2=80=A6 };
> =20
> This is not a template, but must appear in a header. This is amazingly si=
milar =E2=80=93 and easy to teach as =E2=80=9Cif the declaration mentions =
=E2=80=98auto=E2=80=99 or a concept name, the compiler needs the definition=
, either to deduce something or to inline the body into the caller.=E2=80=
=9D Right?
> =20
> Actually, that is not right -- in fact, it is mostly wrong.
> =20
> Only if the return type is deduced do you need a definition.
> =20
> So:
> =20
> void f(auto,auto);
> void g(ForwardIterator);
> =20
> do not need definitions.
> =20
> John.
>=20
>=20
> =20
> Herb
> =20
> PS =E2=80=93 Since you mention =E2=80=9Cnovices=E2=80=9D writing template=
s, in my experience (and to my surprise) I=E2=80=99ve found that not only n=
ovices but also intermediate developers (like 5-7 year veterans) don=E2=80=
=99t write templates very much. [I expect this to change with concepts, for=
the good.] I discovered this by chance when I had a class exercise that in=
cluded writing a very simple template, and as I walked through the class du=
ring the exercise I was surprised that most of the groups asked about the s=
yntax for writing a template =E2=80=93 a dead giveaway that they didn=E2=80=
=99t write templates very often, yet these were pretty experienced develope=
rs who used C++ every day, but just never needed to write templates much in=
their normal code. To validate that this wasn=E2=80=99t just an outlier gr=
oup, I=E2=80=99ve watched that exercise in a number of classes over several=
years and found a similar result =E2=80=93 the majority of even reasonably=
experienced C++ programmers asked about the syntax for how to write a temp=
late.
> =20
> =20
> =20
> From: Nicol Bolas [mailto:jmckesson@gmail.com]=20
> Sent: Friday, March 6, 2015 9:21 AM
> To: std-discussion@isocpp.org
> Cc: c++std-core@accu.org; std-proposals@isocpp.org; faisalv@gmail.com; He=
rb Sutter
> Subject: Re: [c++std-core-27204] Re: An implementation of enhanced auto d=
eduction and abbreviated template syntax using Clang
> =20
> On Thursday, March 5, 2015 at 7:24:32 PM UTC-5, Herb Sutter wrote:
> To paraphrase Stroustrup, it=E2=80=99s not about functional programming a=
nd object-oriented programming and generic programming=E2=80=A6 =E2=80=9Cit=
=E2=80=99s all just programming.=E2=80=9D
> =20
> > Templates are a fundamentally different kind of construct
> =20
> Why? Every full specialization of a function template is just a function.
>=20
> OK, let's explore this.
>=20
> Let's say that I'm a novice C++ programmer. I don't really know much abou=
t the language. But I have some basic knowledge.
>=20
> Now, I've been told that when I write functions, I put a prototype in a h=
eader file so that other people can use it. But I also put the implementati=
on in a source file, so that it stays hidden. So I write:
>=20
> //header
> RetType func_name(Type1 arg1, ...);
>=20
> //source
> RetType func_name(Type1 arg1, ...)
> {
> //implementation
> }
>=20
>=20
> OK, fine.
>=20
> I've also been told about a different class of functions: template functi=
ons. For reasons I haven't been told and don't much care about (since I'm a=
novice), I have to put the implementation in the header file. So I know th=
at if I type the word "template", then that function's implementation has t=
o go into a header. So I always do this:
>=20
> //header
> template<typename T>
> RetType func_name_template(T arg1, ...)
> {
> //implementation
> }
>=20
> //source doesn't exist.
>=20
> =20
> OK, fine. So... explain to me, the novice C++ programmer, why this doesn'=
t work:
>=20
> //header
> RetType func_name_concept(ConceptName arg1, ...);
>=20
> //source
> RetType func_name_concept(ConceptName arg1, ...)
> {
> //implementation
> }
>=20
> Explain to me, the novice C++ programmer, why this thing which doesn't lo=
ok like a template suddenly became a template. Explain to me why I have to =
implement it in a header, even though it looks exactly like every other non=
-template function declaration/definition.
>=20
> To the novice C++ programmer, it isn't "all just programming." Whether so=
mething is a template matters.
>=20
> Oh, you could say, "well just put everything in a header." That's... insa=
ne. Compile times for C++ projects of significant size are already huge eve=
n when you try to only put what you need in headers. Adding the burden of s=
hoving everything in a header is crazy.
>=20
> Now, if you can promise me that the same version of C++ that will include=
this terse syntax will also include modules, I will immediately stop carin=
g. Once that exists, then most of the differences between template and non-=
template functions will be erased. And therefore, so too can the syntactic =
differences.
>=20
> But so long as there is a difference in how you implement template and no=
n-template functions, I say that there should be an obvious difference in s=
yntax too.
>=20
> =20
> > My issue is with, well, any syntax that declares a template without hav=
ing to type either the word "template" or the use of "<>" brackets.
> =20
> That ship has sailed:
> =20
> auto plus =3D [](auto x, auto y) { return x+y; }
> =20
> which even already decays to an ordinary pointer to function, etc.
>=20
> That doesn't decay into a function pointer. It can't; the operator() is a=
template.
> =20
> =20
> Clarifying Q: Are we mainly arguing about whether to require the three ch=
aracters =3D, [, and ] ?
> Except that there is a difference between creating a lambda (which create=
s a functor) and creating a function (which can be overloaded).
>=20
> =20
> Not only has the ship sailed, but I for one like the direction it=E2=80=
=99s sailing. I see no reason why functions should be forced to spell =E2=
=80=9Ctemplate=E2=80=9D and =E2=80=9C<>=E2=80=9D. What value does it add? I=
t=E2=80=99s =E2=80=9Cjust programming.=E2=80=9D In fact, if we didn=E2=80=
=99t have backward compatibility issues with unnamed parameters and such, I=
=E2=80=99d personally probably be fine with just =E2=80=9Cauto plus(x,y){x+=
y}=E2=80=9D as an equivalent function definition. That still doesn=E2=80=99=
t lose any information.
> =20
> Gratuitous syntax is often unnecessary and usually harmful. Saying
> =20
> template<class T, class U>
> auto(T x, U y) -> decltype(x+y) { return x+y; }
> =20
> does not appear to me to contain any more information than
> =20
> auto plus(auto x, auto y) { return x+y; }
> =20
> does it?
> If you take out the late specified return type (I specifically said that =
static deduction was fine), then I don't see the problem with the first one=
..
>=20
> =20
> Requiring the verbose syntax is gratuitous, if the verbose syntax does no=
t add information, does not serve to disambiguate anything, and does not hi=
ghlight a dangerous operation or anything else I can see that deserves to h=
ave attention called to it.
> =20
> There=E2=80=99s a disturbing (to me and at least some others) trend in C+=
+ these days: People seem to be very prone to wanting =E2=80=9Cmore syntax=
=E2=80=9D lately. It=E2=80=99s rather Vasa-like, if only lexically. Let me =
channel certain influential committee members and say: =E2=80=98People thes=
e days are always asking for more syntax! There=E2=80=99s no proposal they=
=E2=80=99ve seen that they couldn=E2=80=99t make uglier with more syntax!=
=E2=80=99
> =20
> Important note: The point here is NOT terseness for terseness=E2=80=99 sa=
ke. I am not arguing that terser is somehow better, that terseness is virtu=
ous in itself. Too many people glorify languages because they=E2=80=99re te=
rser; fewer characters alone doesn=E2=80=99t make code clearer. Rather, my =
point is to avoid gratuitous verbosity. At the other end of the pendulum, t=
oo many people glorify verbose syntax because they think _that_ is somehow =
inherently clearer; usually it isn=E2=80=99t. So I am arguing that neither =
is verbosity virtuous in itself.
> =20
> Herb
> The virtue to me of the large syntax of templates is this:
>=20
> Templates have to be treated differently from non-templates. They have di=
fferent needs of where their implementations live. And because of those nee=
ds, templates make your code compile slower. Even ignoring the compile-time=
cost of template instantiation, your source has to go in the header. And i=
f that header is included in more than one place, then the source for that =
template must be recompiled for every place it is included.
>=20
> Therefore, the bulky template syntax pokes you in the eye every time you =
write something that's going to compile slower. It immediately lets you kno=
w that this function operates under fundamentally different rules than regu=
lar functions.
>=20
> Again, if you could guarantee that we get modules alongside this syntax, =
I'd be fine, since using templates will not hurt your compile times nearly =
as much.
> =20
> =20
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--Apple-Mail=_3407F964-A294-4C8B-8025-C02959B18F79
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"><base href=3D"x-msg://936/"></head><body style=3D"word-wra=
p: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-sp=
ace; "><div>I think the confusion is that Herb wrote:</div><div><br></div><=
div><blockquote type=3D"cite"><blockquote type=3D"cite"><div lang=3D"EN-US"=
link=3D"blue" vlink=3D"purple"><div class=3D"WordSection1" style=3D"page: =
WordSection1; "><div style=3D"border-style: none none none solid; border-le=
ft-width: 1.5pt; border-left-color: blue; padding: 0in 0in 0in 4pt; positio=
n: static; z-index: auto; "><blockquote style=3D"margin-top: 5pt; margin-bo=
ttom: 5pt; "><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-=
family: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font-fa=
mily: Calibri, sans-serif; color: rgb(31, 73, 125); ">=E2=80=9Cif the decla=
ration mentions =E2=80=98auto=E2=80=99 or a concept name, the compiler need=
s the definition, either to deduce something or to inline the body into the=
caller.=E2=80=9D Right?</span></div></blockquote></div></div></div></block=
quote></blockquote></div><div><br></div><div>If you say "auto" or a concept=
name, it is a template. My interpretation of what Herb wrote, is th=
at it was implying more than that.</div><div><br></div><div>john.</div><div=
><br></div><br><div><div>On Mar 6, 2015, at 3:53 PM, Herb Sutter <<a hre=
f=3D"mailto:hsutter@microsoft.com">hsutter@microsoft.com</a>> wrote:</di=
v><br class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div la=
ng=3D"EN-US" link=3D"blue" vlink=3D"purple" style=3D"font-family: Helvetica=
; font-size: medium; font-style: normal; font-variant: normal; font-weight:=
normal; letter-spacing: normal; line-height: normal; orphans: 2; text-alig=
n: -webkit-auto; text-indent: 0px; text-transform: none; white-space: norma=
l; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-te=
xt-stroke-width: 0px; "><div class=3D"WordSection1" style=3D"page: WordSect=
ion1; "><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-famil=
y: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font-family:=
Calibri, sans-serif; color: rgb(31, 73, 125); ">This surprised me so I ask=
ed John offline what he meant, and I think we=E2=80=99re not in disagreemen=
t. You can=E2=80=99t call those unless there are (also) definitions.<o:p></=
o:p></span></div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; f=
ont-family: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; fon=
t-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> </span></di=
v><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Ti=
mes New Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calib=
ri, sans-serif; color: rgb(31, 73, 125); ">What I said is correct: If auto =
(or a concept name) is used in the return type or parameter type, the defin=
ition must be available =E2=80=9Cin a header.=E2=80=9D And this is already =
true for auto return types.<o:p></o:p></span></div><div style=3D"margin: 0i=
n 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><=
span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb=
(31, 73, 125); "> </span></div><div style=3D"margin: 0in 0in 0.0001pt;=
font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"f=
ont-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); =
">I did not mean to imply that you couldn=E2=80=99t also have a forward dec=
laration too (which you can have for function templates but not for auto re=
turns), but it still must be accompanied by a definition which was the poin=
t under discussion, namely that the definition still has to be available in=
the header.<o:p></o:p></span></div><div style=3D"margin: 0in 0in 0.0001pt;=
font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"f=
ont-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); =
"> </span></div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12p=
t; font-family: 'Times New Roman', serif; "><span style=3D"font-size: 11pt;=
font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">Note that I=
=E2=80=99m excluding the =E2=80=9Cextern template=E2=80=9D case, which is a=
special case and about controlling where instantiations occur (or limiting=
them) rather than about writing the generally usable function template its=
elf=E2=80=A6 so IMO extern templates aren=E2=80=99t applicable to this ques=
tion.<o:p></o:p></span></div><div style=3D"margin: 0in 0in 0.0001pt; font-s=
ize: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-siz=
e: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> =
;</span></div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font=
-family: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font-f=
amily: Calibri, sans-serif; color: rgb(31, 73, 125); ">Herb<o:p></o:p></spa=
n></div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-famil=
y: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font-family:=
Calibri, sans-serif; color: rgb(31, 73, 125); "> </span></div><div st=
yle=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New R=
oman', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-=
serif; color: rgb(31, 73, 125); "> </span></div><div style=3D"border-s=
tyle: none none none solid; border-left-width: 1.5pt; border-left-color: bl=
ue; padding: 0in 0in 0in 4pt; position: static; z-index: auto; "><div><div =
style=3D"border-style: solid none none; border-top-width: 1pt; border-top-c=
olor: rgb(225, 225, 225); padding: 3pt 0in 0in; "><div style=3D"margin: 0in=
0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><b=
><span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; ">From:<=
/span></b><span style=3D"font-size: 11pt; font-family: Calibri, sans-serif;=
"><span class=3D"Apple-converted-space"> </span>John Spicer [mailto:j=
hs@<a href=3D"http://edg.com" style=3D"color: purple; text-decoration: unde=
rline; ">edg.com</a>]<span class=3D"Apple-converted-space"> </span><br=
><b>Sent:</b><span class=3D"Apple-converted-space"> </span>Friday, Mar=
ch 6, 2015 10:38 AM<br><b>To:</b><span class=3D"Apple-converted-space">&nbs=
p;</span><a href=3D"mailto:c++std-core@accu.org" style=3D"color: purple; te=
xt-decoration: underline; ">c++std-core@accu.org</a><br><b>Cc:</b><span cla=
ss=3D"Apple-converted-space"> </span>Nicol Bolas;<span class=3D"Apple-=
converted-space"> </span><a href=3D"mailto:std-discussion@isocpp.org" =
style=3D"color: purple; text-decoration: underline; ">std-discussion@isocpp=
..org</a>;<span class=3D"Apple-converted-space"> </span><a href=3D"mail=
to:std-proposals@isocpp.org" style=3D"color: purple; text-decoration: under=
line; ">std-proposals@isocpp.org</a>;<span class=3D"Apple-converted-space">=
</span><a href=3D"mailto:faisalv@gmail.com" style=3D"color: purple; t=
ext-decoration: underline; ">faisalv@gmail.com</a><br><b>Subject:</b><span =
class=3D"Apple-converted-space"> </span>[c++std-core-27231] Re: An imp=
lementation of enhanced auto deduction and abbreviated template syntax usin=
g Clang<o:p></o:p></span></div></div></div><div style=3D"margin: 0in 0in 0.=
0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><o:p>&nbs=
p;</o:p></div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font=
-family: 'Times New Roman', serif; "><o:p> </o:p></div><div><div><div =
style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New=
Roman', serif; ">On Mar 6, 2015, at 1:27 PM, Herb Sutter <<a href=3D"ma=
ilto:hsutter@microsoft.com" style=3D"color: purple; text-decoration: underl=
ine; ">hsutter@microsoft.com</a>> wrote:<o:p></o:p></div></div><div styl=
e=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Rom=
an', serif; "><br><br><o:p></o:p></div><blockquote style=3D"margin-top: 5pt=
; margin-bottom: 5pt; "><div><div style=3D"margin: 0in 0in 0.0001pt; font-s=
ize: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-siz=
e: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">><=
/span><span class=3D"apple-converted-space"> </span>To the novice C++ =
programmer, it<span class=3D"apple-converted-space"> </span><i>isn't</=
i><span class=3D"apple-converted-space"> </span>"all just programming.=
" Whether something is a template<span class=3D"apple-converted-space">&nbs=
p;</span><i>matters</i>.<o:p></o:p></div></div><div><div style=3D"margin: 0=
in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; ">=
<span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rg=
b(31, 73, 125); "> </span><o:p></o:p></div></div><div><div style=3D"ma=
rgin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', se=
rif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; co=
lor: rgb(31, 73, 125); ">Why? Only because of where you put the definition,=
and that=E2=80=99s (a) teachable and (b) not new because the same issue ex=
ists already with:</span><o:p></o:p></div></div><div><div style=3D"margin: =
0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "=
><span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: r=
gb(31, 73, 125); "> </span><o:p></o:p></div></div><div><div style=3D"m=
argin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', s=
erif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; c=
olor: rgb(31, 73, 125); "> &=
nbsp; auto f() { =E2=80=A6 };</span><o:=
p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size:=
12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-size: 1=
1pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> </s=
pan><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; fon=
t-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-=
size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">Th=
is is not a template, but must appear in a header. This is amazingly simila=
r =E2=80=93 and easy to teach as =E2=80=9Cif the declaration mentions =E2=
=80=98auto=E2=80=99 or a concept name, the compiler needs the definition, e=
ither to deduce something or to inline the body into the caller.=E2=80=9D R=
ight?</span><o:p></o:p></div></div></blockquote><div><div style=3D"margin: =
0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "=
><o:p> </o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; =
font-size: 12pt; font-family: 'Times New Roman', serif; ">Actually, that is=
not right -- in fact, it is mostly wrong.<o:p></o:p></div></div><div><div =
style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New=
Roman', serif; "><o:p> </o:p></div></div><div><div style=3D"margin: 0=
in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; ">=
Only if the return type is deduced do you need a definition.<o:p></o:p></di=
v></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-=
family: 'Times New Roman', serif; "><o:p> </o:p></div></div><div><div =
style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New=
Roman', serif; ">So:<o:p></o:p></div></div><div><div style=3D"margin: 0in =
0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><o:=
p> </o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font=
-size: 12pt; font-family: 'Times New Roman', serif; "><span class=3D"apple-=
tab-span"> <span class=
=3D"Apple-converted-space"> </span></span>void f(auto,auto);<o:p></o:p=
></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; =
font-family: 'Times New Roman', serif; "><span class=3D"apple-tab-span">&nb=
sp; <span class=3D"Apple-con=
verted-space"> </span></span>void g(ForwardIterator);<o:p></o:p></div>=
</div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-fa=
mily: 'Times New Roman', serif; "><o:p> </o:p></div></div><div><div st=
yle=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New R=
oman', serif; ">do not need definitions.<o:p></o:p></div></div><div><div st=
yle=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New R=
oman', serif; "><o:p> </o:p></div></div><div><div style=3D"margin: 0in=
0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; ">Jo=
hn.<o:p></o:p></div></div><div style=3D"margin: 0in 0in 0.0001pt; font-size=
: 12pt; font-family: 'Times New Roman', serif; "><br><br><o:p></o:p></div><=
blockquote style=3D"margin-top: 5pt; margin-bottom: 5pt; "><div><div style=
=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roma=
n', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-ser=
if; color: rgb(31, 73, 125); "> </span><o:p></o:p></div></div><div><di=
v style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times N=
ew Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, s=
ans-serif; color: rgb(31, 73, 125); ">Herb</span><o:p></o:p></div></div><di=
v><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Ti=
mes New Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calib=
ri, sans-serif; color: rgb(31, 73, 125); "> </span><o:p></o:p></div></=
div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-fami=
ly: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font-family=
: Calibri, sans-serif; color: rgb(31, 73, 125); ">PS =E2=80=93 Since you me=
ntion =E2=80=9Cnovices=E2=80=9D writing templates, in my experience (and to=
my surprise) I=E2=80=99ve found that not only novices but also intermediat=
e developers (like 5-7 year veterans) don=E2=80=99t write templates very mu=
ch. [I expect this to change with concepts, for the good.] I discovered thi=
s by chance when I had a class exercise that included writing a very simple=
template, and as I walked through the class during the exercise I was surp=
rised that most of the groups asked about the syntax for writing a template=
=E2=80=93 a dead giveaway that they didn=E2=80=99t write templates very of=
ten, yet these were pretty experienced developers who used C++ every day, b=
ut just never needed to write templates much in their normal code. To valid=
ate that this wasn=E2=80=99t just an outlier group, I=E2=80=99ve watched th=
at exercise in a number of classes over several years and found a similar r=
esult =E2=80=93 the majority of even reasonably experienced C++ programmers=
asked about the syntax for how to write a template.</span><o:p></o:p></div=
></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-f=
amily: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font-fam=
ily: Calibri, sans-serif; color: rgb(31, 73, 125); "> </span><o:p></o:=
p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt;=
font-family: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; f=
ont-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> </span><o=
:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size=
: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-size: =
11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> </=
span><o:p></o:p></div></div><div style=3D"border-style: none none none soli=
d; border-left-width: 1.5pt; border-left-color: blue; padding: 0in 0in 0in =
4pt; "><div><div style=3D"border-style: solid none none; border-top-width: =
1pt; border-top-color: rgb(225, 225, 225); padding: 3pt 0in 0in; "><div sty=
le=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Ro=
man', serif; "><b><span style=3D"font-size: 11pt; font-family: Calibri, san=
s-serif; ">From:</span></b><span class=3D"apple-converted-space"><span styl=
e=3D"font-size: 11pt; font-family: Calibri, sans-serif; "> </span></sp=
an><span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; ">Nico=
l Bolas [mailto:jmckesson@<a href=3D"http://gmail.com" style=3D"color: purp=
le; text-decoration: underline; "><span style=3D"color: rgb(149, 79, 114); =
">gmail.com</span></a>]<span class=3D"apple-converted-space"> </span><=
br><b>Sent:</b><span class=3D"apple-converted-space"> </span>Friday, M=
arch 6, 2015 9:21 AM<br><b>To:</b><span class=3D"apple-converted-space">&nb=
sp;</span><a href=3D"mailto:std-discussion@isocpp.org" style=3D"color: purp=
le; text-decoration: underline; "><span style=3D"color: rgb(149, 79, 114); =
">std-discussion@isocpp.org</span></a><br><b>Cc:</b><span class=3D"apple-co=
nverted-space"> </span><a href=3D"mailto:c++std-core@accu.org" style=
=3D"color: purple; text-decoration: underline; "><span style=3D"color: rgb(=
149, 79, 114); ">c++std-core@accu.org</span></a>;<span class=3D"apple-conve=
rted-space"> </span><a href=3D"mailto:std-proposals@isocpp.org" style=
=3D"color: purple; text-decoration: underline; "><span style=3D"color: rgb(=
149, 79, 114); ">std-proposals@isocpp.org</span></a>;<span class=3D"apple-c=
onverted-space"> </span><a href=3D"mailto:faisalv@gmail.com" style=3D"=
color: purple; text-decoration: underline; "><span style=3D"color: rgb(149,=
79, 114); ">faisalv@gmail.com</span></a>; Herb Sutter<br><b>Subject:</b><s=
pan class=3D"apple-converted-space"> </span>Re: [c++std-core-27204] Re=
: An implementation of enhanced auto deduction and abbreviated template syn=
tax using Clang</span><o:p></o:p></div></div></div><div><div style=3D"margi=
n: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif=
; "> <o:p></o:p></div></div><div><div><div style=3D"margin: 0in 0in 0.=
0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; ">On Thursd=
ay, March 5, 2015 at 7:24:32 PM UTC-5, Herb Sutter wrote:<o:p></o:p></div><=
/div><blockquote style=3D"border-style: none none none solid; border-left-w=
idth: 1pt; border-left-color: rgb(204, 204, 204); padding: 0in 0in 0in 6pt;=
margin: 5pt 0in 5pt 4.8pt; "><div><div style=3D"margin: 0in 0in 0.0001pt; =
font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"fo=
nt-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "=
>To paraphrase Stroustrup, it=E2=80=99s not about functional programming an=
d object-oriented programming and generic programming=E2=80=A6 =E2=80=9Cit=
=E2=80=99s all<span class=3D"apple-converted-space"> </span><i>just pr=
ogramming</i>.=E2=80=9D</span><o:p></o:p></div></div><div><div style=3D"mar=
gin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', ser=
if; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-serif; col=
or: rgb(31, 73, 125); "> </span><o:p></o:p></div></div><div><div style=
=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roma=
n', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-ser=
if; color: rgb(31, 73, 125); ">><span class=3D"apple-converted-space">&n=
bsp;</span></span>Templates are a fundamentally different kind of construct=
<o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-si=
ze: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-size=
: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> =
</span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; =
font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"fo=
nt-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "=
>Why? Every full specialization of a function template is just a function.<=
/span><o:p></o:p></div></div></blockquote><div><p class=3D"MsoNormal" style=
=3D"margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', =
serif; "><br>OK, let's explore this.<br><br>Let's say that I'm a novice C++=
programmer. I don't really know much about the language. But I have some b=
asic knowledge.<br><br>Now, I've been told that when I write functions, I p=
ut a prototype in a header file so that other people can use it. But I also=
put the implementation in a source file, so that it stays hidden. So I wri=
te:<o:p></o:p></p><div style=3D"border: 1pt solid rgb(187, 187, 187); paddi=
ng: 0in; word-wrap: break-word; "><div style=3D"margin: 0in 0in 0.0001pt; f=
ont-size: 12pt; font-family: 'Times New Roman', serif; background-color: rg=
b(250, 250, 250); "><span class=3D"styled-by-prettify"><span style=3D"font-=
size: 10pt; font-family: 'Courier New'; color: rgb(136, 0, 0); ">//header</=
span></span><span style=3D"font-size: 10pt; font-family: 'Courier New'; "><=
br><span class=3D"styled-by-prettify"><span style=3D"color: rgb(102, 0, 102=
); ">RetType</span></span><span class=3D"apple-converted-space"> </spa=
n><span class=3D"styled-by-prettify">func_name<span style=3D"color: rgb(102=
, 102, 0); ">(</span><span style=3D"color: rgb(102, 0, 102); ">Type1</span>=
</span><span class=3D"apple-converted-space"> </span><span class=3D"st=
yled-by-prettify">arg1<span style=3D"color: rgb(102, 102, 0); ">,</span>&nb=
sp;<span style=3D"color: rgb(102, 102, 0); ">...);</span></span><br><br><sp=
an class=3D"styled-by-prettify"><span style=3D"color: rgb(136, 0, 0); ">//s=
ource</span></span><br><span class=3D"styled-by-prettify"><span style=3D"co=
lor: rgb(102, 0, 102); ">RetType</span></span><span class=3D"apple-converte=
d-space"> </span><span class=3D"styled-by-prettify">func_name<span sty=
le=3D"color: rgb(102, 102, 0); ">(</span><span style=3D"color: rgb(102, 0, =
102); ">Type1</span></span><span class=3D"apple-converted-space"> </sp=
an><span class=3D"styled-by-prettify">arg1<span style=3D"color: rgb(102, 10=
2, 0); ">,</span> <span style=3D"color: rgb(102, 102, 0); ">...)</span=
></span><br><span class=3D"styled-by-prettify"><span style=3D"color: rgb(10=
2, 102, 0); ">{</span></span><br><span class=3D"styled-by-prettify"><span s=
tyle=3D"color: rgb(136, 0, 0); ">//implementation</span></span><br><span cl=
ass=3D"styled-by-prettify"><span style=3D"color: rgb(102, 102, 0); ">}</spa=
n></span></span><o:p></o:p></div></div><p class=3D"MsoNormal" style=3D"marg=
in: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif; "=
><br><br>OK, fine.<br><br>I've also been told about a different class of fu=
nctions: template functions. For reasons I haven't been told and don't much=
care about (since I'm a novice), I have to put the implementation in the h=
eader file. So I know that if I type the word "template", then that functio=
n's implementation has to go into a header. So I always do this:<o:p></o:p>=
</p><div style=3D"border: 1pt solid rgb(187, 187, 187); padding: 0in; word-=
wrap: break-word; "><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt=
; font-family: 'Times New Roman', serif; background-color: rgb(250, 250, 25=
0); "><span class=3D"styled-by-prettify"><span style=3D"font-size: 10pt; fo=
nt-family: 'Courier New'; color: rgb(136, 0, 0); ">//header</span></span><s=
pan style=3D"font-size: 10pt; font-family: 'Courier New'; "><br><span class=
=3D"styled-by-prettify"><span style=3D"color: rgb(0, 0, 136); ">template</s=
pan><span style=3D"color: rgb(102, 102, 0); "><</span><span style=3D"col=
or: rgb(0, 0, 136); ">typename</span></span><span class=3D"apple-converted-=
space"> </span><span class=3D"styled-by-prettify">T<span style=3D"colo=
r: rgb(102, 102, 0); ">></span></span><br><span class=3D"styled-by-prett=
ify"><span style=3D"color: rgb(102, 0, 102); ">RetType</span></span><span c=
lass=3D"apple-converted-space"> </span><span class=3D"styled-by-pretti=
fy">func_name_template<span style=3D"color: rgb(102, 102, 0); ">(</span>T a=
rg1<span style=3D"color: rgb(102, 102, 0); ">,</span> <span style=3D"c=
olor: rgb(102, 102, 0); ">...)</span></span><br><span class=3D"styled-by-pr=
ettify"><span style=3D"color: rgb(102, 102, 0); ">{</span></span><br><span =
class=3D"styled-by-prettify"><span style=3D"color: rgb(136, 0, 0); ">//impl=
ementation</span></span><br><span class=3D"styled-by-prettify"><span style=
=3D"color: rgb(102, 102, 0); ">}</span></span><br><br><span class=3D"styled=
-by-prettify"><span style=3D"color: rgb(136, 0, 0); ">//source doesn't exis=
t.</span></span></span><o:p></o:p></div></div><p class=3D"MsoNormal" style=
=3D"margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', =
serif; "><br> <br>OK, fine. So... explain to me, the novice C++ progra=
mmer, why this doesn't work:<o:p></o:p></p><div style=3D"border: 1pt solid =
rgb(187, 187, 187); padding: 0in; word-wrap: break-word; "><div style=3D"ma=
rgin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', se=
rif; background-color: rgb(250, 250, 250); "><span class=3D"styled-by-prett=
ify"><span style=3D"font-size: 10pt; font-family: 'Courier New'; color: rgb=
(136, 0, 0); ">//header</span></span><span style=3D"font-size: 10pt; font-f=
amily: 'Courier New'; "><br><span class=3D"styled-by-prettify"><span style=
=3D"color: rgb(102, 0, 102); ">RetType</span></span><span class=3D"apple-co=
nverted-space"> </span><span class=3D"styled-by-prettify">func_name_co=
ncept<span style=3D"color: rgb(102, 102, 0); ">(</span><span style=3D"color=
: rgb(102, 0, 102); ">ConceptName</span></span><span class=3D"apple-convert=
ed-space"> </span><span class=3D"styled-by-prettify">arg1<span style=
=3D"color: rgb(102, 102, 0); ">,</span> <span style=3D"color: rgb(102,=
102, 0); ">...);</span></span><br><br><span class=3D"styled-by-prettify"><=
span style=3D"color: rgb(136, 0, 0); ">//source</span></span><br><span clas=
s=3D"styled-by-prettify"><span style=3D"color: rgb(102, 0, 102); ">RetType<=
/span></span><span class=3D"apple-converted-space"> </span><span class=
=3D"styled-by-prettify">func_name_concept<span style=3D"color: rgb(102, 102=
, 0); ">(</span><span style=3D"color: rgb(102, 0, 102); ">ConceptName</span=
></span><span class=3D"apple-converted-space"> </span><span class=3D"s=
tyled-by-prettify">arg1<span style=3D"color: rgb(102, 102, 0); ">,</span>&n=
bsp;<span style=3D"color: rgb(102, 102, 0); ">...)</span></span><br><span c=
lass=3D"styled-by-prettify"><span style=3D"color: rgb(102, 102, 0); ">{</sp=
an></span><br><span class=3D"styled-by-prettify"><span style=3D"color: rgb(=
136, 0, 0); ">//implementation</span></span><br><span class=3D"styled-by-pr=
ettify"><span style=3D"color: rgb(102, 102, 0); ">}</span></span></span><o:=
p></o:p></div></div><p class=3D"MsoNormal" style=3D"margin: 0in 0in 12pt; f=
ont-size: 12pt; font-family: 'Times New Roman', serif; "><br>Explain to me,=
the novice C++ programmer, why this thing which doesn't look like a templa=
te suddenly<span class=3D"apple-converted-space"> </span><i>became</i>=
<span class=3D"apple-converted-space"> </span>a template. Explain to m=
e why I have to implement it in a header, even though it looks exactly like=
every other non-template function declaration/definition.<br><br>To the no=
vice C++ programmer, it<span class=3D"apple-converted-space"> </span><=
i>isn't</i><span class=3D"apple-converted-space"> </span>"all just pro=
gramming." Whether something is a template<span class=3D"apple-converted-sp=
ace"> </span><i>matters</i>.<br><br>Oh, you could say, "well just put<=
span class=3D"apple-converted-space"> </span><i>everything</i><span cl=
ass=3D"apple-converted-space"> </span>in a header." That's... insane. =
Compile times for C++ projects of significant size are already huge even wh=
en you try to only put what you need in headers. Adding the burden of shovi=
ng everything in a header is crazy.<br><br>Now, if you can promise me that =
the same version of C++ that will include this terse syntax will also inclu=
de<span class=3D"apple-converted-space"> </span><i>modules</i>, I will=
immediately stop caring. Once that exists, then most of the differences be=
tween template and non-template functions will be erased. And therefore, so=
too can the syntactic differences.<br><br>But so long as there is a differ=
ence in how you implement template and non-template functions, I say that t=
here should be an obvious difference in syntax too.<o:p></o:p></p></div><bl=
ockquote style=3D"border-style: none none none solid; border-left-width: 1p=
t; border-left-color: rgb(204, 204, 204); padding: 0in 0in 0in 6pt; margin:=
5pt 0in 5pt 4.8pt; "><div><div style=3D"margin: 0in 0in 0.0001pt; font-siz=
e: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-size:=
11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> <=
/span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; f=
ont-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"fon=
t-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">=
><span class=3D"apple-converted-space"> </span></span>My issue is w=
ith, well, any syntax that declares a template without having to type eithe=
r the word "template" or the use of "<>" brackets.<o:p></o:p></div></=
div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-fami=
ly: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font-family=
: Calibri, sans-serif; color: rgb(31, 73, 125); "> </span><o:p></o:p><=
/div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; fo=
nt-family: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; font=
-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">That ship has sail=
ed:</span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001p=
t; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D=
"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125)=
; "> </span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in =
0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><span s=
tyle=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 7=
3, 125); "> &nbs=
p; auto plus =3D [](auto x, auto y) { return x+y; }=
</span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; =
font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"fo=
nt-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "=
> </span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0=
001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><span styl=
e=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, =
125); ">which even already decays to an ordinary pointer to function, etc.<=
/span><o:p></o:p></div></div></blockquote><div><div style=3D"margin: 0in 0i=
n 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><br>T=
hat doesn't decay into a function pointer. It can't; the operator() is a te=
mplate.<br> <o:p></o:p></div></div><blockquote style=3D"border-style: =
none none none solid; border-left-width: 1pt; border-left-color: rgb(204, 2=
04, 204); padding: 0in 0in 0in 6pt; margin: 5pt 0in 5pt 4.8pt; "><div><div =
style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New=
Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, san=
s-serif; color: rgb(31, 73, 125); "> </span><o:p></o:p></div></div><di=
v><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Ti=
mes New Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calib=
ri, sans-serif; color: rgb(31, 73, 125); ">Clarifying Q: Are we mainly argu=
ing about whether to require the three characters =3D, [, and ] ?</span><o:=
p></o:p></div></div></blockquote><div><p class=3D"MsoNormal" style=3D"margi=
n: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif; ">=
Except that there is a difference between creating a lambda (which creates =
a functor) and creating a function (which can be overloaded).<o:p></o:p></p=
></div><blockquote style=3D"border-style: none none none solid; border-left=
-width: 1pt; border-left-color: rgb(204, 204, 204); padding: 0in 0in 0in 6p=
t; margin: 5pt 0in 5pt 4.8pt; "><div><div style=3D"margin: 0in 0in 0.0001pt=
; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"=
font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);=
"> </span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0=
..0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><span st=
yle=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73=
, 125); ">Not only has the ship sailed, but I for one like the direction it=
=E2=80=99s sailing. I see no reason why functions should be forced to spell=
=E2=80=9Ctemplate=E2=80=9D and =E2=80=9C<>=E2=80=9D. What value does=
it add? It=E2=80=99s =E2=80=9Cjust programming.=E2=80=9D In fact, if we di=
dn=E2=80=99t have backward compatibility issues with unnamed parameters and=
such, I=E2=80=99d personally probably be fine with just =E2=80=9Cauto plus=
(x,y){x+y}=E2=80=9D as an equivalent function definition. That still doesn=
=E2=80=99t lose any information.</span><o:p></o:p></div></div><div><div sty=
le=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Ro=
man', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-s=
erif; color: rgb(31, 73, 125); "> </span><o:p></o:p></div></div><div><=
div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times=
New Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calibri,=
sans-serif; color: rgb(31, 73, 125); ">Gratuitous syntax is often unnecess=
ary and usually harmful. Saying</span><o:p></o:p></div></div><div><div styl=
e=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Rom=
an', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-se=
rif; color: rgb(31, 73, 125); "> </span><o:p></o:p></div></div><div><d=
iv style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times =
New Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, =
sans-serif; color: rgb(31, 73, 125); "> =
template<class T,=
class U></span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0i=
n 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><span=
style=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31,=
73, 125); "> &n=
bsp; auto(T x, U y) -> decltype(x+y) { return x+=
y; }</span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001=
pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=
=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 1=
25); "> </span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0=
in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><spa=
n style=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31=
, 73, 125); ">does not appear to me to contain any more information than</s=
pan><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; fon=
t-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-=
size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">&n=
bsp;</span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001=
pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=
=3D"font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 1=
25); "> &n=
bsp; auto plus(auto x, auto y) { return x+y; }</span><o:p=
></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: =
12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-size: 11=
pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> </sp=
an><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font=
-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-s=
ize: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">doe=
s it?</span><o:p></o:p></div></div></blockquote><div><div style=3D"margin: =
0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "=
>If you take out the late specified return type (I specifically said that s=
tatic deduction was fine), then I don't see the problem with the first one.=
<br><br> <o:p></o:p></div></div><blockquote style=3D"border-style: non=
e none none solid; border-left-width: 1pt; border-left-color: rgb(204, 204,=
204); padding: 0in 0in 0in 6pt; margin: 5pt 0in 5pt 4.8pt; "><div><div sty=
le=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Ro=
man', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-s=
erif; color: rgb(31, 73, 125); ">Requiring the verbose syntax is gratuitous=
, if the verbose syntax does not add information, does not serve to disambi=
guate anything, and does not highlight a dangerous operation or anything el=
se I can see that deserves to have attention called to it.</span><o:p></o:p=
></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; =
font-family: 'Times New Roman', serif; "><span style=3D"font-size: 11pt; fo=
nt-family: Calibri, sans-serif; color: rgb(31, 73, 125); "> </span><o:=
p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-size:=
12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-size: 1=
1pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">There=E2=
=80=99s a disturbing (to me and at least some others) trend in C++ these da=
ys: People seem to be very prone to wanting =E2=80=9Cmore syntax=E2=80=9D l=
ately. It=E2=80=99s rather Vasa-like, if only lexically. Let me channel cer=
tain influential committee members and say: =E2=80=98People these days are =
always asking for more syntax! There=E2=80=99s no proposal they=E2=80=99ve =
seen that they couldn=E2=80=99t make uglier with more syntax!=E2=80=99</spa=
n><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt; font-=
size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"font-si=
ze: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">&nbs=
p;</span><o:p></o:p></div></div><div><div style=3D"margin: 0in 0in 0.0001pt=
; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style=3D"=
font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);=
">Important note: The point here is NOT terseness for terseness=E2=80=99 s=
ake. I am not arguing that terser is somehow better, that terseness is virt=
uous in itself. Too many people glorify languages because they=E2=80=99re t=
erser; fewer characters alone doesn=E2=80=99t make code clearer. Rather, my=
point is to avoid gratuitous verbosity. At the other end of the pendulum, =
too many people glorify verbose syntax because they think _that_ is somehow=
inherently clearer; usually it isn=E2=80=99t. So I am arguing that neither=
is verbosity virtuous in itself.</span><o:p></o:p></div></div><div><div st=
yle=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New R=
oman', serif; "><span style=3D"font-size: 11pt; font-family: Calibri, sans-=
serif; color: rgb(31, 73, 125); "> </span><o:p></o:p></div></div><div>=
<div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Time=
s New Roman', serif; "><span style=3D"font-size: 11pt; font-family: Calibri=
, sans-serif; color: rgb(31, 73, 125); ">Herb</span><o:p></o:p></div></div>=
</blockquote><div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; =
font-family: 'Times New Roman', serif; ">The virtue to me of the large synt=
ax of templates is this:<br><br>Templates have to be treated differently fr=
om non-templates. They have different needs of where their implementations =
live. And because of those needs, templates make your code compile slower. =
Even ignoring the compile-time cost of template instantiation, your source =
has to go in the header. And if that header is included in more than one pl=
ace, then the source for that template must be recompiled for every place i=
t is included.<br><br>Therefore, the bulky template syntax pokes you in the=
eye every time you write something that's going to compile slower. It imme=
diately lets you know that this function operates under fundamentally diffe=
rent rules than regular functions.<br><br>Again, if you could guarantee tha=
t we get modules alongside this syntax, I'd be fine, since using templates =
will not hurt your compile times nearly as much.<o:p></o:p></div></div><div=
><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Tim=
es New Roman', serif; "> <o:p></o:p></div></div></div></div></blockquo=
te></div><div style=3D"margin: 0in 0in 0.0001pt; font-size: 12pt; font-fami=
ly: 'Times New Roman', serif; "><o:p> </o:p></div></div></div></div></=
blockquote></div><br></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--Apple-Mail=_3407F964-A294-4C8B-8025-C02959B18F79--
.