220 8748 <CAD6_Qj-2LQUbFWcxFxA0F+zURdmsx8UgyRsJLsTnb2M0J7YTgw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?ISO-8859-1?Q?David_Rodr=EDguez_Ibeas?= <dibeas@ieee.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Templetized namespaces
Date: Tue, 21 Jan 2014 17:16:58 -0500
Lines: 234
Approved: news@gmane.org
Message-ID: <CAD6_Qj-2LQUbFWcxFxA0F+zURdmsx8UgyRsJLsTnb2M0J7YTgw@mail.gmail.com>
References: <CAFdMc-214LLZ3GtZyd3rZ1MwM4Q0qaTZFZmkXuyDPVZDU6aJ=w@mail.gmail.com>
	<4cfc2db6-97da-4750-9296-5aaaa3475014@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c204f2eaf18e04f0825d44
X-Trace: ger.gmane.org 1390342614 9873 80.91.229.3 (21 Jan 2014 22:16:54 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 21 Jan 2014 22:16:54 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDIIVO6GQULBBW7D7OLAKGQEJMGZBFA@isocpp.org Tue Jan 21 23:17:02 2014
Return-path: <std-proposals+bncBDIIVO6GQULBBW7D7OLAKGQEJMGZBFA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oa0-f72.google.com ([209.85.219.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDIIVO6GQULBBW7D7OLAKGQEJMGZBFA@isocpp.org>)
	id 1W5jcz-000526-7w
	for gclcip-std-proposals@m.gmane.org; Tue, 21 Jan 2014 23:17:01 +0100
Original-Received: by mail-oa0-f72.google.com with SMTP id i4sf10876810oah.7
        for <gclcip-std-proposals@m.gmane.org>; Tue, 21 Jan 2014 14:17:00 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:sender:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=1t5VmpoFxfUNLG0uKq0oLI7CXD3+K5pbW1v8IjfQofw=;
        b=Qr4SjMpiI8GjXwb3dq3ghwmdxlOKc0IxY9fla54RNSfxTwag8nFuCmqcwp9Wyxau5M
         k6PlDxqfhrVAxUmEK2VW33OTyZdevL1UJp6x4KZVQTBUZferAuZ4igDmqnt/6OedRKur
         p5CjtdqCn8djGN1NSO/uKLamOq/J2xe62a281VaThy8WfrJM/ZTCYCboD9osnAXTbg3i
         TDuH/PvlmIwkXllvXZqLhXfRO2MtP4KNfEsjSmF7g/DRLOdlVAhIyiCr772kU9+iZ7wV
         rn65ZTM4LXnTrUyAWrYkd+LY+1aEdgSyHp2gm8caOEhvYGs5IXFlu65cKRJscOOH6pnY
         OQcA==
X-Gm-Message-State: ALoCoQlDNGMKSEm1JL1GO+Krj1c7Lj0Q4PmiRnKPijEFvygIC6q4TKw66wlxJU20m2yhvkL5vJpJ
X-Received: by 10.42.51.141 with SMTP id e13mr3670566icg.28.1390342620262;
        Tue, 21 Jan 2014 14:17:00 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.42.138 with SMTP id c10ls1343372qga.62.gmail; Tue, 21 Jan
 2014 14:16:59 -0800 (PST)
X-Received: by 10.236.118.201 with SMTP id l49mr16006218yhh.78.1390342619451;
        Tue, 21 Jan 2014 14:16:59 -0800 (PST)
Original-Received: from mail-ob0-x236.google.com (mail-ob0-x236.google.com [2607:f8b0:4003:c01::236])
        by mx.google.com with ESMTPS id 21si5444919yhx.106.2014.01.21.14.16.59
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 21 Jan 2014 14:16:59 -0800 (PST)
Received-SPF: pass (google.com: domain of dribeas@gmail.com designates 2607:f8b0:4003:c01::236 as permitted sender) client-ip=2607:f8b0:4003:c01::236;
Original-Received: by mail-ob0-f182.google.com with SMTP id wm4so3947053obc.41
        for <std-proposals@isocpp.org>; Tue, 21 Jan 2014 14:16:59 -0800 (PST)
X-Received: by 10.182.243.161 with SMTP id wz1mr22995630obc.10.1390342618933;
 Tue, 21 Jan 2014 14:16:58 -0800 (PST)
Original-Sender: dribeas@gmail.com
Original-Received: by 10.182.117.133 with HTTP; Tue, 21 Jan 2014 14:16:58 -0800 (PST)
In-Reply-To: <4cfc2db6-97da-4750-9296-5aaaa3475014@isocpp.org>
X-Original-Sender: dibeas@ieee.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of dribeas@gmail.com designates 2607:f8b0:4003:c01::236 as permitted
 sender) smtp.mail=dribeas@gmail.com;       dkim=pass header.i=@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:8748
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8748>

--001a11c204f2eaf18e04f0825d44
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

What are the shortcomings of using a class template as a poor-man's
template?

I imagine that the first one is that it must be defined in a single header,
so if the amount of code used internally is large enough it could make it
hard to maintain.The syntax looks like a using-directive, do you also wish
for the lookup changes associated with it? I imagine this to be the case,
right? Can you use the same library in one program with different template
arguments?

Can you provide a small code sample with how it would look like?


On Sun, Jan 19, 2014 at 1:16 PM, Andrew Tomazos <andrewtomazos@gmail.com>wr=
ote:

> Namespaces differ from classes in that they can be split within and
> amongst translation units.  The definition of a namespace is not required
> to be the same in different translation units.  Multiple namespace
> definitions of the same namespace in the same translation unit are
> logically merged into one (the first is called the original, the followin=
g
> are called extensions).
>
> How do template namespace specialization and template namespace
> instantiation interact with these new properties that are not present in
> other template entities?
>
> Also namespaces can contain the following declarations, whereas classes
> cannot:
>
> explicit-instantiation
> explicit-specialization
> linkage-speci=EF=AC=81cation
> namespace-de=EF=AC=81nition
> attribute-declaration
> asm-de=EF=AC=81nition
> namespace-alias-de=EF=AC=81nition
> using-directive
> opaque-enum-declaration
>
> Now that all these are possible member declarations of a template entity,
> how are they handled?
>
> Also you need to think about program initialization.  The members of a
> namespace have a bunch of rules about when they are initialized and in wh=
at
> order.  How will these rules interact with template namespace instances?
>
> The best approach for this type of feature would be to put together an
> experimental compiler extension to gcc or clang that implements template
> namespaces.  This would shake out all the above issues (and likely more)
> which you could then use as the basis of a proposal.
>
> On Sunday, January 19, 2014 6:26:57 PM UTC+1, dgutson . wrote:
>>
>> Hi.
>>
>>    I found a number of situations where the ability to templetize
>> namespaces would be very useful.
>>
>> My latest use case is this: I'm writing a library that is configured
>> through a number of (non-type) template arguments. Such configuration
>> affects to all the classes of the library. To be more specific, it's a
>> fault-tolerant library for the aerospace industry where the whole librar=
y
>> is tuned with some integers (some of then related to redundancy due to
>> ionizing radiation).
>>
>> The most natural thing would be to put all the classes in a namespace,
>> and let the namespace be templetized with such arguments.
>> Moreover, a using namespace with the appropriate arguments would suffice
>> for all the application. For example:
>>
>>     using namespace TheLibrary<arg1, arg2, arg3>;
>>
>> I didn't write the proposal yet, since I'd like to get some feedback.
>>
>> Thanks,
>>
>>    Daniel.
>>
>> ps: The library will be available soon and uses template metaprogramming
>> based on the arguments.
>>
>>
>> --
>> Who=E2=80=99s got the sweetest disposition?
>> One guess, that=E2=80=99s who?
>> Who=E2=80=99d never, ever start an argument?
>> Who never shows a bit of temperament?
>> Who's never wrong but always right?
>> Who'd never dream of starting a fight?
>> Who get stuck with all the bad luck?
>>
>  --
>
> ---
> 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/.

--001a11c204f2eaf18e04f0825d44
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">What are the shortcomings of using a class template as a p=
oor-man&#39;s template?<div><br></div><div>I imagine that the first one is =
that it must be defined in a single header, so if the amount of code used i=
nternally is large enough it could make it hard to maintain.The syntax look=
s like a using-directive, do you also wish for the lookup changes associate=
d with it? I imagine this to be the case, right? Can you use the same libra=
ry in one program with different template arguments?</div>
<div><br></div><div>Can you provide a small code sample with how it would l=
ook like?=C2=A0<br></div></div><div class=3D"gmail_extra"><br><br><div clas=
s=3D"gmail_quote">On Sun, Jan 19, 2014 at 1:16 PM, Andrew Tomazos <span dir=
=3D"ltr">&lt;<a href=3D"mailto:andrewtomazos@gmail.com" target=3D"_blank">a=
ndrewtomazos@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">Namespaces differ from clas=
ses in that they can be split within and amongst translation units. =C2=A0T=
he definition of a namespace is not required to be the same in different tr=
anslation units. =C2=A0Multiple namespace definitions of the same namespace=
 in the same translation unit are logically merged into one (the first is c=
alled the original, the following are called extensions).<div>
<br></div><div>How do template namespace specialization and template namesp=
ace instantiation interact with these new properties that are not present i=
n other template entities?</div><div><br></div><div>Also namespaces can con=
tain the following declarations, whereas classes cannot:</div>
<div><br></div><div><div>explicit-instantiation<br></div><div>explicit-spec=
ialization</div><div>linkage-speci=EF=AC=81cation</div><div>namespace-de=EF=
=AC=81nition</div><div>attribute-declaration<br></div><div>asm-de=EF=AC=81n=
ition<br></div><div>
namespace-alias-de=EF=AC=81nition</div><div>using-directive<br></div><div>o=
paque-enum-declaration<br></div></div><div><br></div><div>Now that all thes=
e are possible member declarations of a template entity, how are they handl=
ed?</div>
<div><br></div><div>Also you need to think about program initialization. =
=C2=A0The members of a namespace have a bunch of rules about when they are =
initialized and in what order. =C2=A0How will these rules interact with tem=
plate namespace instances?</div>
<div><br></div><div>The best approach for this type of feature would be to =
put together an experimental compiler extension to gcc or clang that implem=
ents template namespaces. =C2=A0This would shake out all the above issues (=
and likely more) which you could then use as the basis of a proposal.</div>
<div><div class=3D"h5"><div><br></div><div>On Sunday, January 19, 2014 6:26=
:57 PM UTC+1, dgutson . wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr">
Hi.<div><br></div><div>=C2=A0 =C2=A0I found a number of situations where th=
e ability to templetize namespaces would be very useful.</div><div><br></di=
v><div>My latest use case is this: I&#39;m writing a library that is config=
ured through a number of (non-type) template arguments. Such configuration =
affects to all the classes of the library. To be more specific, it&#39;s a =
fault-tolerant library for the aerospace industry where the whole library i=
s tuned with some integers (some of then related to redundancy due to ioniz=
ing radiation).</div>

<div><br></div><div>The most natural thing would be to put all the classes =
in a namespace, and let the namespace be templetized with such arguments.</=
div><div>Moreover, a using namespace with the appropriate arguments would s=
uffice for all the application. For example:</div>

<div><br></div><div>=C2=A0 =C2=A0 using namespace TheLibrary&lt;arg1, arg2,=
 arg3&gt;;</div><div><br></div><div>I didn&#39;t write the proposal yet, si=
nce I&#39;d like to get some feedback.</div><div><br></div><div>Thanks,</di=
v><div>

<br></div><div>=C2=A0 =C2=A0Daniel.</div><div><br></div><div>ps: The librar=
y will be available soon and uses template metaprogramming based on the arg=
uments.</div><div><br clear=3D"all"><div><br></div>-- <br>Who=E2=80=99s got=
 the sweetest disposition?<br>

One guess, that=E2=80=99s who?<br>Who=E2=80=99d never, ever start an argume=
nt?<br>Who never shows a bit of temperament?<br>Who&#39;s never wrong but a=
lways right?<br>Who&#39;d never dream of starting a fight?<br>Who get stuck=
 with all the bad luck?=20
</div></div>
</blockquote></div></div></div></div><div class=3D"HOEnZb"><div class=3D"h5=
">

<p></p>

-- <br>
=C2=A0<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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />

--001a11c204f2eaf18e04f0825d44--

.
