Topic: [c++std-core-27222] An implementation of
Author: Jonathan Wakely <cxx@kayari.org>
Date: Fri, 6 Mar 2015 17:37:53 +0000
Raw View
On 6 March 2015 at 17:21, Nicol Bolas wrote:
> Explain to me, the novice C++ programmer, why this thing which doesn't look
> 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.
>
> To the novice C++ programmer, it isn't "all just programming." Whether
> something is a template matters.
Ah, the "won't somebody think of the children" argument.
The answer to why it suddenly became a template is that its parameter
is a concept, not a type. A concept is a family of types. I don't see
why that should be much harder to teach than "a function template is a
family of functions" and "a class template is a family of types".
If we're teaching novices how to write C++ templates based on "just
put template<blah> before it and make sure it's in a header" that
doesn't seem like a very sound basis for learning anything more than
arbitrary syntactic rules and cargo cult programming.
(Is it time to trim the CC list so this doesn't continue to be
cross-posted everywhere?)
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
To post to this group, send email to std-discussion@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 6 Mar 2015 10:07:06 -0800 (PST)
Raw View
------=_Part_676_23935842.1425665226345
Content-Type: multipart/alternative;
boundary="----=_Part_677_710254505.1425665226345"
------=_Part_677_710254505.1425665226345
Content-Type: text/plain; charset=UTF-8
On Friday, March 6, 2015 at 12:38:14 PM UTC-5, Jonathan Wakely wrote:
>
> On 6 March 2015 at 17:21, Nicol Bolas wrote:
> > Explain to me, the novice C++ programmer, why this thing which doesn't
> look
> > 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.
> >
> > To the novice C++ programmer, it isn't "all just programming." Whether
> > something is a template matters.
>
> Ah, the "won't somebody think of the children" argument.
>
> The answer to why it suddenly became a template is that its parameter
> is a concept, not a type. A concept is a family of types. I don't see
> why that should be much harder to teach than "a function template is a
> family of functions" and "a class template is a family of types".
>
If a "family of functions" is so fundamentally different from a regular
function that it can't be declared/defined in the same way, why does it
look exactly like a regular function? If swapping one identifier for
another can so radically change how you go about implementing something,
shouldn't it be more syntactically obvious that you've made a major change?
Without the template keyword, it doesn't look like a template. And
therefore, it is not immediately obvious that it should be treated as such.
--
---
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_677_710254505.1425665226345
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Friday, March 6, 2015 at 12:38:14 PM UTC-5, Jon=
athan Wakely wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 6 March =
2015 at 17:21, Nicol Bolas wrote:
<br>> Explain to me, the novice C++ programmer, why this thing which doe=
sn't look
<br>> like a template suddenly became a template. Explain to me why I ha=
ve to
<br>> implement it in a header, even though it looks exactly like every =
other
<br>> non-template function declaration/definition.
<br>>
<br>> To the novice C++ programmer, it isn't "all just programming." Whe=
ther
<br>> something is a template matters.
<br>
<br>Ah, the "won't somebody think of the children" argument.
<br>
<br>The answer to why it suddenly became a template is that its parameter
<br>is a concept, not a type. A concept is a family of types. I don't=
see
<br>why that should be much harder to teach than "a function template is a
<br>family of functions" and "a class template is a family of types".
<br></blockquote><div><br>If a "family of functions" is so fundamentally di=
fferent from a regular function that it can't be declared/defined in the sa=
me way, why does it look exactly like a regular function? If swapping one i=
dentifier for another can so radically change how you go about implementing=
something, shouldn't it be more syntactically obvious that you've made a m=
ajor change?<br><br>Without the template keyword, it doesn't look like a te=
mplate. And therefore, it is not immediately obvious that it should be trea=
ted as such.</div><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" 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_677_710254505.1425665226345--
------=_Part_676_23935842.1425665226345--
.