Topic: [c++std-core-27228] An implementation of


Author: Bjarne Stroustrup <bjarne@stroustrup.com>
Date: Fri, 06 Mar 2015 13:32:10 -0500
Raw View
This is a multi-part message in MIME format.
--------------070808090203090604000604
Content-Type: text/plain; charset=UTF-8; format=flowed



On 3/6/2015 1:22 PM, Geoffrey Romer wrote:
>
> On Fri, Mar 6, 2015 at 10:09 AM, Bjarne Stroustrup
> <bjarne@stroustrup.com <mailto:bjarne@stroustrup.com>> wrote:
>
>
>
>     On 3/6/2015 1:07 PM, Nicol Bolas wrote:
>>
>>
>>     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.
>>
>
>     People will learn. Learning that
>         void f(auto);
>     implies template is kid's play compared to some things we expect
>     people to figure out.
>
>
> That's not the case he's talking about. He's talking about this one:
>
> void f(T);
>
> I don't see how "people will learn" to tell whether that's a template,
> because there just fundamentally isn't enough information there to
> answer that question, and in real code the necessary information might
> be anywhere in the transitive #include graph.

Reminds me of people complaining that they don't know which type Foo is in

     void f(Foo);

and therefore they don't know what arguments it insists.

That can indeed be a real problem, but not one that I loose sleep over.

--

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

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

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <br>
    <br>
    <div class=3D"moz-cite-prefix">On 3/6/2015 1:22 PM, Geoffrey Romer
      wrote:<br>
    </div>
    <blockquote
cite=3D"mid:CA+cyFgtDHXT7Q45gO3bwVdQY50aD+4S2t0ouwuQtEpVsZfXe1Q@mail.gmail.=
com"
      type=3D"cite">
      <div dir=3D"ltr">
        <div class=3D"gmail_extra"><br>
          <div class=3D"gmail_quote">On Fri, Mar 6, 2015 at 10:09 AM,
            Bjarne Stroustrup <span dir=3D"ltr">&lt;<a
                moz-do-not-send=3D"true"
                href=3D"mailto:bjarne@stroustrup.com" target=3D"_blank">bja=
rne@stroustrup.com</a>&gt;</span>
            wrote:<br>
            <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor=3D"#FFFFFF" text=3D"#000000">
                <div>
                  <div class=3D"h5"> <br>
                    <br>
                    <div>On 3/6/2015 1:07 PM, Nicol Bolas wrote:<br>
                    </div>
                    <blockquote type=3D"cite">
                      <div dir=3D"ltr"><br>
                        <br>
                        On Friday, March 6, 2015 at 12:38:14 PM UTC-5,
                        Jonathan Wakely wrote:
                        <blockquote class=3D"gmail_quote"
                          style=3D"margin:0;margin-left:0.8ex;border-left:1=
px
                          #ccc solid;padding-left:1ex">On 6 March 2015
                          at 17:21, Nicol Bolas wrote: <br>
                          &gt; Explain to me, the novice C++ programmer,
                          why this thing which doesn't look <br>
                          &gt; like a template suddenly became a
                          template. Explain to me why I have to <br>
                          &gt; implement it in a header, even though it
                          looks exactly like every other <br>
                          &gt; non-template function
                          declaration/definition. <br>
                          &gt; <br>
                          &gt; To the novice C++ programmer, it isn't
                          "all just programming." Whether <br>
                          &gt; 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.=C2=A0 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
                          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?<br>
                          <br>
                          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.</div>
                        <br>
                      </div>
                    </blockquote>
                    <br>
                  </div>
                </div>
                People will learn. Learning that<br>
                =C2=A0=C2=A0=C2=A0 void f(auto);<br>
                implies template is kid's play compared to some things
                we expect people to figure out.<br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>That's not the case he's talking about. He's talking
              about this one:</div>
            <div><br>
            </div>
            <div>void f(T);=C2=A0</div>
          </div>
          <br>
        </div>
        <div class=3D"gmail_extra">I don't see how "people will learn" to
          tell whether that's a template, because there just
          fundamentally isn't enough information there to answer that
          question, and in real code the necessary information might be
          anywhere in the transitive #include graph.</div>
      </div>
    </blockquote>
    <br>
    Reminds me of people complaining that they don't know which type Foo
    is in<br>
    <br>
    =C2=A0=C2=A0=C2=A0 void f(Foo);<br>
    <br>
    and therefore they don't know what arguments it insists.<br>
    <br>
    That can indeed be a real problem, but not one that I loose sleep
    over.<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&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 />

--------------070808090203090604000604--

.


Author: Scott Prager <splinterofchaos@gmail.com>
Date: Fri, 6 Mar 2015 11:36:56 -0800 (PST)
Raw View
------=_Part_818_1060065318.1425670616874
Content-Type: multipart/alternative;
 boundary="----=_Part_819_993464114.1425670616874"

------=_Part_819_993464114.1425670616874
Content-Type: text/plain; charset=UTF-8



On Friday, March 6, 2015 at 1:32:12 PM UTC-5, Bjarne Stroustrup wrote:


> Reminds me of people complaining that they don't know which type Foo is in
>
>     void f(Foo);
>
> and therefore they don't know what arguments it insists.
>
> That can indeed be a real problem, but not one that I loose sleep over.
>

Examples like this, whether *Foo*  is a concept or concrete type, made me
consider that functions with concept arguments should be labeled as
templates... but then I realized the contradiction: If *Foo* is a type and
one
wants to call it, one must look up *Foo*'s declaration. Therefor, *Foo*
being a
concept doesn't actually require any more or less knowledge of the code base
than it being a type. In either case, the declaration must be looked up.

--

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

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

<div dir=3D"ltr"><br><br>On Friday, March 6, 2015 at 1:32:12 PM UTC-5, Bjar=
ne Stroustrup wrote:<div>&nbsp;</div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left:=
 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
    Reminds me of people complaining that they don't know which type Foo
    is in<br>
    <br>
    &nbsp;&nbsp;&nbsp; void f(Foo);<br>
    <br>
    and therefore they don't know what arguments it insists.<br>
    <br>
    That can indeed be a real problem, but not one that I loose sleep
    over.<br></div></blockquote><div><div><br></div><div>Examples like this=
, whether <i>Foo</i> &nbsp;is a concept or concrete type, made me</div><div=
>consider that functions with concept arguments should be labeled as</div><=
div>templates... but then I realized the contradiction: If <i>Foo</i> is a =
type and one</div><div>wants to call it, one must look up <i>Foo</i>'s decl=
aration. Therefor, <i>Foo</i> being a</div><div>concept doesn't actually re=
quire any more or less knowledge of the code base</div><div>than it being a=
 type. In either case, the declaration must be looked up.</div></div><div><=
br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Discussion&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-discussion+unsubscribe@isocpp.org">std-discus=
sion+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-discussion@isocp=
p.org">std-discussion@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-discussion/">http://groups.google.com/a/isocpp.org/group/std-discussion=
/</a>.<br />

------=_Part_819_993464114.1425670616874--
------=_Part_818_1060065318.1425670616874--

.