220 18162 <CAFdMc-2cMHdDiF1X-8MBdteS+s8oP5CYRh_NnOaykMg0E5MFww@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: "dgutson ." <danielgutson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: template blocks
Date: Sat, 23 May 2015 10:12:24 -0300
Lines: 198
Approved: news@gmane.org
Message-ID: <CAFdMc-2cMHdDiF1X-8MBdteS+s8oP5CYRh_NnOaykMg0E5MFww@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e0115eb7026fff00516bf8765
X-Trace: ger.gmane.org 1432386752 13663 80.91.229.3 (23 May 2015 13:12:32 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 23 May 2015 13:12:32 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDE3NBMV6UFBBOXZQGVQKGQEIAJUIHY@isocpp.org Sat May 23 15:12:29 2015
Return-path: <std-proposals+bncBDE3NBMV6UFBBOXZQGVQKGQEIAJUIHY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBBOXZQGVQKGQEIAJUIHY@isocpp.org>)
	id 1Yw9E4-0005L0-0w
	for gclcip-std-proposals@m.gmane.org; Sat, 23 May 2015 15:12:28 +0200
Original-Received: by iebgx4 with SMTP id gx4sf98860936ieb.1
        for <gclcip-std-proposals@m.gmane.org>; Sat, 23 May 2015 06:12:26 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:date:message-id:subject:from:to
         :content-type:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=f+TWbaaqWmvbm95wbbcAOJYQQfc99Lq6CtczgjvMGos=;
        b=Yd0QqVcHAnB2Xzbv3RAX7YKbYBNOCbiKZ4Vwfx4h0yQdaOGgE2L6EhGysuKU50m7IM
         Zp/6RZ0eWqwAanaJpCjXI9yElP0j1jHd74d0n0vYoS8OorWu6BNQEx7+yvEIBgEirnUv
         bpCSoWTdlkukYQCTw2HifJzLRlm+a/ReuGYEZaoew1xMy0/CMOYjOwjJdnstRoULMW1G
         soKu+3NM6KoXf78PPRDHADiS/eVmxM7x8AI7ud0EF5fdsl1H605XB0QD6dsB5gtZtCL8
         fX0SiWye0jilF8HGSznS6c6i73eXHLTMR5/VEJuYF25LIUCZlmOYZwJ4u2gY0SAwWdEx
         9+qg==
X-Gm-Message-State: ALoCoQk6EwoqXtz672MojOU0Si+mCZhbB6Z+HyjhgH+T5qFEvgnI5iAYMlNXgdcGAcvaf5lePuhm
X-Received: by 10.42.204.75 with SMTP id fl11mr17686426icb.16.1432386746845;
        Sat, 23 May 2015 06:12:26 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.22.175 with SMTP id 44ls2338876qgn.79.gmail; Sat, 23 May
 2015 06:12:26 -0700 (PDT)
X-Received: by 10.170.133.208 with SMTP id z199mr14700799ykb.61.1432386745995;
        Sat, 23 May 2015 06:12:25 -0700 (PDT)
Original-Received: from mail-yk0-x22f.google.com (mail-yk0-x22f.google.com. [2607:f8b0:4002:c07::22f])
        by mx.google.com with ESMTPS id k204si3190084yka.126.2015.05.23.06.12.25
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 23 May 2015 06:12:25 -0700 (PDT)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 2607:f8b0:4002:c07::22f as permitted sender) client-ip=2607:f8b0:4002:c07::22f;
Original-Received: by ykfr66 with SMTP id r66so12542058ykf.0
        for <std-proposals@isocpp.org>; Sat, 23 May 2015 06:12:25 -0700 (PDT)
X-Received: by 10.236.2.230 with SMTP id 66mr12862948yhf.129.1432386745596;
 Sat, 23 May 2015 06:12:25 -0700 (PDT)
Original-Received: by 10.129.90.213 with HTTP; Sat, 23 May 2015 06:12:24 -0700 (PDT)
Original-Received: by 10.129.90.213 with HTTP; Sat, 23 May 2015 06:12:24 -0700 (PDT)
X-Original-Sender: danielgutson@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of danielgutson@gmail.com designates 2607:f8b0:4002:c07::22f as
 permitted sender) smtp.mail=danielgutson@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:18162
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18162>

--089e0115eb7026fff00516bf8765
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

El 23/5/2015 10:09, escribi=C3=B3:
>
>
> El 22/5/2015 12:20, "Douglas Boffey" <douglas.boffey@gmail.com> escribi=
=C3=B3:
> >
> > Consider:
> >
> > template <typename T>
> > class Foo {
> >   // whatever
> > public:
> >   void bar();
> >   void baz();
> >   void another_fn();
> >   // ...
> > };
>
> FWIW, I think that something similar has been proposed some years ago:
>
> //no namespace version:

Errata: "non template version"

> namespace class Foo {
> void bar() { ... }
> void baz() { ... }
> }
>
> // templated version:
> template <typename T>
> namespace class Foo {
> void bar() { ... }
> void baz() { ... }
> ...rest of the definitions
> }
>
> It was slightly different since blocks are class-specific.
> I don't remember what crushed this.
>
> >
> > To define the functions, you would have to write:
> >
> > template <typename T>
> > void Foo::bar() { /* ... */ }
> >
> > template <typename T>
> > void Foo::baz() { /* ... */ }
> >
> > template <typename T>
> > void Foo::another_fn() { /* ... */ }
> >
> > Wouldn=E2=80=99t it be better if we could write:
> >
> > template <typename T> {
> >   void Foo::bar() { /* ... */ }
> >   void Foo::baz() { /* ... */ }
> >   void Foo::another_fn() { /* ... */ }
> > }
> >
> > Pro:
> > - less typing (although that is not the motivating reason)
> > - cleaner, clearer syntax, improving maintainability
> > - easier to check correctness
> >
> > What do people think?
> >
> > --
> >
> > ---
> > 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/.

--=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/.

--089e0115eb7026fff00516bf8765
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr"><br>
El 23/5/2015 10:09, escribi=C3=B3:<br>
&gt;<br>
&gt;<br>
&gt; El 22/5/2015 12:20, &quot;Douglas Boffey&quot; &lt;<a href=3D"mailto:d=
ouglas.boffey@gmail.com">douglas.boffey@gmail.com</a>&gt; escribi=C3=B3:<br=
>
&gt; &gt;<br>
&gt; &gt; Consider:<br>
&gt; &gt;<br>
&gt; &gt; template &lt;typename T&gt;<br>
&gt; &gt; class Foo {<br>
&gt; &gt; =C2=A0 // whatever<br>
&gt; &gt; public:<br>
&gt; &gt; =C2=A0 void bar();<br>
&gt; &gt; =C2=A0 void baz();<br>
&gt; &gt; =C2=A0 void another_fn();<br>
&gt; &gt; =C2=A0 // ...<br>
&gt; &gt; };<br>
&gt;<br>
&gt; FWIW, I think that something similar has been proposed some years ago:=
<br>
&gt;<br>
&gt; //no namespace version:</p>
<p dir=3D"ltr">Errata: &quot;non template version&quot;</p>
<p dir=3D"ltr">&gt; namespace class Foo {<br>
&gt; void bar() { ... }<br>
&gt; void baz() { ... }<br>
&gt; }<br>
&gt;<br>
&gt; // templated version:<br>
&gt; template &lt;typename T&gt;<br>
&gt; namespace class Foo {<br>
&gt; void bar() { ... }<br>
&gt; void baz() { ... }<br>
&gt; ...rest of the definitions<br>
&gt; }<br>
&gt;<br>
&gt; It was slightly different since blocks are class-specific.<br>
&gt; I don&#39;t remember what crushed this.<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; To define the functions, you would have to write:<br>
&gt; &gt;<br>
&gt; &gt; template &lt;typename T&gt;<br>
&gt; &gt; void Foo::bar() { /* ... */ }<br>
&gt; &gt;<br>
&gt; &gt; template &lt;typename T&gt;<br>
&gt; &gt; void Foo::baz() { /* ... */ }<br>
&gt; &gt;<br>
&gt; &gt; template &lt;typename T&gt;<br>
&gt; &gt; void Foo::another_fn() { /* ... */ }<br>
&gt; &gt;<br>
&gt; &gt; Wouldn=E2=80=99t it be better if we could write:<br>
&gt; &gt;<br>
&gt; &gt; template &lt;typename T&gt; {<br>
&gt; &gt; =C2=A0 void Foo::bar() { /* ... */ }<br>
&gt; &gt; =C2=A0 void Foo::baz() { /* ... */ }<br>
&gt; &gt; =C2=A0 void Foo::another_fn() { /* ... */ }<br>
&gt; &gt; }<br>
&gt; &gt;<br>
&gt; &gt; Pro:<br>
&gt; &gt; - less typing (although that is not the motivating reason)<br>
&gt; &gt; - cleaner, clearer syntax, improving maintainability<br>
&gt; &gt; - easier to check correctness<br>
&gt; &gt;<br>
&gt; &gt; What do people think?<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;<br>
&gt; &gt; ---<br>
&gt; &gt; You received this message because you are subscribed to the Googl=
e Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
&gt; &gt; To unsubscribe from this group and stop receiving emails from it,=
 send an email to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org"=
>std-proposals+unsubscribe@isocpp.org</a>.<br>
&gt; &gt; To post to this group, send email to <a href=3D"mailto:std-propos=
als@isocpp.org">std-proposals@isocpp.org</a>.<br>
&gt; &gt; 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-p=
roposals/</a>.<br>
</p>

<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 />

--089e0115eb7026fff00516bf8765--

.
