220 8811 <CAFdMc-1=J1mwsOZqLW40ZvWPuStkET3zkNSpnSf0Vjq-efiatw@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: Re: Templetized namespaces
Date: Sat, 25 Jan 2014 22:48:51 -0200
Lines: 326
Approved: news@gmane.org
Message-ID: <CAFdMc-1=J1mwsOZqLW40ZvWPuStkET3zkNSpnSf0Vjq-efiatw@mail.gmail.com>
References: <CAFdMc-214LLZ3GtZyd3rZ1MwM4Q0qaTZFZmkXuyDPVZDU6aJ=w@mail.gmail.com>
	<4cfc2db6-97da-4750-9296-5aaaa3475014@isocpp.org>
	<CAOfiQqk_g0nwNP1TZndqrvmBAtqjhXsC0bAFax0nXwCPvwDw6g@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=bcaec52beba574203504f0d4f4c0
X-Trace: ger.gmane.org 1390697327 15704 80.91.229.3 (26 Jan 2014 00:48:47 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 26 Jan 2014 00:48:47 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDE3NBMV6UFBB5VWSGLQKGQEBPF4XQI@isocpp.org Sun Jan 26 01:48:55 2014
Return-path: <std-proposals+bncBDE3NBMV6UFBB5VWSGLQKGQEBPF4XQI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f200.google.com ([209.85.217.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBB5VWSGLQKGQEBPF4XQI@isocpp.org>)
	id 1W7DuB-00045c-6O
	for gclcip-std-proposals@m.gmane.org; Sun, 26 Jan 2014 01:48:55 +0100
Original-Received: by mail-lb0-f200.google.com with SMTP id c11sf8954703lbj.7
        for <gclcip-std-proposals@m.gmane.org>; Sat, 25 Jan 2014 16:48:54 -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: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=xZ1sZ9nCOuKr13fMyHUKj0XTUv1KQ3xqBrJ/sNb6VRQ=;
        b=mwS33ojbDdgXRa5RLmPmYJQLloMyIPRWSPcTCf9zQtJDlTeXBx1BTc/bfszOA97nlX
         l1u+B8GC+i47ei3IJNxwhRhPa7QVk3lHTLpL+JyFawQUPGL/O8e8Caaxl3oaSi6vBO5Z
         MZw91INzE+91WbVhZk8xnq5nPDXGIzup2/PAuOtFKPwOi93Fm6XfYezO+o5ZqYkLvytt
         wuQlYms8+rQms1L0eJhoxyAkV6AHqHUcT6NMWbPTHUwSrIpwjIgLpZSPZXa9mnTUlNLt
         kiO9OGJdukH6lu7psw1a3O+3S8Nf/3gRiRJn+/21BjF+JNAPlImLgVFdrAxFaHtaKM0y
         DMFQ==
X-Gm-Message-State: ALoCoQl7GXfY59HIVNVfM+Ux9cdxLCO+xEIhKoLPZ/+WyBGra/Ut3aLapMvNG/lFGvfpiDOthG8w
X-Received: by 10.205.105.2 with SMTP id do2mr5788774bkc.1.1390697334462;
        Sat, 25 Jan 2014 16:48:54 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.20.100 with SMTP id m4ls668819wie.38.gmail; Sat, 25 Jan
 2014 16:48:53 -0800 (PST)
X-Received: by 10.204.114.12 with SMTP id c12mr12753138bkq.61.1390697333762;
        Sat, 25 Jan 2014 16:48:53 -0800 (PST)
Original-Received: from mail-pb0-x231.google.com (mail-pb0-x231.google.com [2607:f8b0:400e:c01::231])
        by mx.google.com with ESMTPS id ou7si8542354bkb.304.2014.01.25.16.48.53
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 25 Jan 2014 16:48:53 -0800 (PST)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 2607:f8b0:400e:c01::231 as permitted sender) client-ip=2607:f8b0:400e:c01::231;
Original-Received: by mail-pb0-f49.google.com with SMTP id up15so4576586pbc.36
        for <std-proposals@isocpp.org>; Sat, 25 Jan 2014 16:48:51 -0800 (PST)
X-Received: by 10.66.27.107 with SMTP id s11mr22551555pag.64.1390697331825;
 Sat, 25 Jan 2014 16:48:51 -0800 (PST)
Original-Received: by 10.70.78.200 with HTTP; Sat, 25 Jan 2014 16:48:51 -0800 (PST)
In-Reply-To: <CAOfiQqk_g0nwNP1TZndqrvmBAtqjhXsC0bAFax0nXwCPvwDw6g@mail.gmail.com>
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:400e:c01::231 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: <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:8811
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8811>

--bcaec52beba574203504f0d4f4c0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tue, Jan 21, 2014 at 8:54 PM, Richard Smith <richard@metafoo.co.uk>wrote=
:

> On Sun, Jan 19, 2014 at 10:16 AM, Andrew Tomazos <andrewtomazos@gmail.com=
>wrote:
>
>> Namespaces differ from classes in that they can be split within and
>> amongst translation units.  The definition of a namespace is not require=
d
>> 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 followi=
ng
>> 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 w=
hat
>> 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.
>>
>
> In addition to the above list, a proposal on this would need to consider
> whether namespace templates could support explicit specializations, parti=
al
> specializations, and explicit instantiations (both for themselves and for
> their members).
>

Maybe funny things could be done with this and template metaprogramming:
template namespaces recursively instantiating themselves.
However, I'm not sure if new inventions would arise not done before with
template classes.


>
>
>> 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 libra=
ry
>>> 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 suffic=
e
>>> 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.
>>>
>>
> I think this feature would have value, and seems worth putting before the
> committee.
>
>
>> Thanks,
>>>
>>>    Daniel.
>>>
>>> ps: The library will be available soon and uses template metaprogrammin=
g
>>> 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 Group=
s
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n
>> 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/.
>>
>
>  --
>
> ---
> 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
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?

--=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/.

--bcaec52beba574203504f0d4f4c0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Tue, Jan 21, 2014 at 8:54 PM, Richard Smith <span dir=3D"ltr">&l=
t;<a href=3D"mailto:richard@metafoo.co.uk" target=3D"_blank">richard@metafo=
o.co.uk</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"><div class=3D"gmail_extra">=
<div class=3D"gmail_quote"><div class=3D"im">On Sun, Jan 19, 2014 at 10:16 =
AM, Andrew Tomazos <span dir=3D"ltr">&lt;<a href=3D"mailto:andrewtomazos@gm=
ail.com" target=3D"_blank">andrewtomazos@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></blockquote><div><br></div></div><div>In addition to the above list,=
 a proposal on this would need to consider whether namespace templates coul=
d support explicit specializations, partial specializations, and explicit i=
nstantiations (both for themselves and for their members).</div>
</div></div></div></blockquote><div><br></div><div>Maybe funny things could=
 be done with this and template metaprogramming: template namespaces recurs=
ively instantiating themselves.</div><div>However, I&#39;m not sure if new =
inventions would arise not done before with template classes.</div>
<div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=
=3D"gmail_extra"><div class=3D"gmail_quote"><div class=3D"im">
<div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div>=
<div>On Sunday, January 19, 2014 6:26:57 PM UTC+1, dgutson . wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1=
px #ccc solid;padding-left:1ex">

<div dir=3D"ltr">Hi.<div><br></div><div>=C2=A0 =C2=A0I found a number of si=
tuations where the ability to templetize namespaces would be very useful.</=
div><div><br></div><div>My latest use case is this: I&#39;m writing a libra=
ry that is configured through a number of (non-type) template arguments. Su=
ch configuration affects to all the classes of the library. To be more spec=
ific, it&#39;s a fault-tolerant library for the aerospace industry where th=
e whole library is tuned with some integers (some of then related to redund=
ancy due to ionizing 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></blockquote></div></div>=
</div>

</div></blockquote><div><br></div></div><div>I think this feature would hav=
e value, and seems worth putting before the committee.</div><div class=3D"i=
m"><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir=3D"ltr"><div><div><div><blockquote class=3D"gmail_quote" style=3D"=
margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><di=
v dir=3D"ltr"><div>Thanks,</div><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><div>

<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></div><br></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><br clear=3D"all"><div><br></div>-- <br>=
Who=E2=80=99s got the sweetest disposition?<br>One guess, that=E2=80=99s wh=
o?<br>Who=E2=80=99d never, ever start an argument?<br>Who never shows a bit=
 of temperament?<br>Who&#39;s never wrong but always right?<br>
Who&#39;d never dream of starting a fight?<br>Who get stuck with all the ba=
d luck?=20
</div></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 />

--bcaec52beba574203504f0d4f4c0--

.
