220 8809 <CAFdMc-3bHYRTCNDDCrEBe+R6b0wuHeRU6q6zwp2akRX9DwsbDQ@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:22:38 -0200
Lines: 276
Approved: news@gmane.org
Message-ID: <CAFdMc-3bHYRTCNDDCrEBe+R6b0wuHeRU6q6zwp2akRX9DwsbDQ@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=bcaec52beba5b2dc0304f0d49670
X-Trace: ger.gmane.org 1390695756 1673 80.91.229.3 (26 Jan 2014 00:22:36 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 26 Jan 2014 00:22:36 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDE3NBMV6UFBBUNKSGLQKGQE3DKKW3I@isocpp.org Sun Jan 26 01:22:44 2014
Return-path: <std-proposals+bncBDE3NBMV6UFBBUNKSGLQKGQE3DKKW3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f199.google.com ([209.85.217.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBBUNKSGLQKGQE3DKKW3I@isocpp.org>)
	id 1W7DUo-0001ke-2D
	for gclcip-std-proposals@m.gmane.org; Sun, 26 Jan 2014 01:22:42 +0100
Original-Received: by mail-lb0-f199.google.com with SMTP id l4sf8931081lbv.6
        for <gclcip-std-proposals@m.gmane.org>; Sat, 25 Jan 2014 16:22:41 -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=NbbOKGE0XHE8LUDMKv2i2fhnD1YvAgDApAdiivO/bPM=;
        b=YnWwfVQ4VX4dYHOuJjfGg/SQY8d10z3kmVeJYto3KwgSjZq/9bsx4V2oZ/avk8sCO6
         4Lb1DDlILCJWGlJmGhXzM0tWkUa2zbLMjw3RTMyA+Frlwg63tvntnkM8zmP9mQuEIALK
         PGjVZPCz0A1XG0h4axslpa81KWMo1+h99m74u8L+8N/w4ZVEIg0xCOBvEV7QqMNIl68I
         D3KOst9RZN4n0+8Qx3Mjmvi/5Er/aQFWjTOEj7VQEIt9DDk2Xagqh0XTotWC0mPTBZcO
         SrSupFsR7p2h0LYe6swQEnEla/8JoM3fyyUb37B0P64KgH+cE1+VFoEuOSwyz9kfGH7F
         mY3Q==
X-Gm-Message-State: ALoCoQnwrWPHykftj6Y8pfT52Wur88hpjZT74yKTDQnB7/SpmTIt1Fixr0JZ4WVM7LhsnjG1PPxj
X-Received: by 10.112.223.8 with SMTP id qq8mr4558430lbc.9.1390695761559;
        Sat, 25 Jan 2014 16:22:41 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.90.178 with SMTP id bx18ls682789wib.26.canary; Sat, 25 Jan
 2014 16:22:40 -0800 (PST)
X-Received: by 10.204.117.139 with SMTP id r11mr14015236bkq.37.1390695760765;
        Sat, 25 Jan 2014 16:22:40 -0800 (PST)
Original-Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [2607:f8b0:400e:c02::231])
        by mx.google.com with ESMTPS id h4si8486633bkr.258.2014.01.25.16.22.40
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 25 Jan 2014 16:22:40 -0800 (PST)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 2607:f8b0:400e:c02::231 as permitted sender) client-ip=2607:f8b0:400e:c02::231;
Original-Received: by mail-pd0-f177.google.com with SMTP id x10so4431838pdj.36
        for <std-proposals@isocpp.org>; Sat, 25 Jan 2014 16:22:38 -0800 (PST)
X-Received: by 10.66.27.107 with SMTP id s11mr22464505pag.64.1390695758878;
 Sat, 25 Jan 2014 16:22:38 -0800 (PST)
Original-Received: by 10.70.78.200 with HTTP; Sat, 25 Jan 2014 16:22:38 -0800 (PST)
In-Reply-To: <4cfc2db6-97da-4750-9296-5aaaa3475014@isocpp.org>
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:c02::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:8809
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8809>

--bcaec52beba5b2dc0304f0d49670
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Sun, Jan 19, 2014 at 3: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?
>

I understand that, in terms of a standard, all these considerations have to
be taken into account. That's why I call for help here. Please note that
the very concrete problem I'm referring to still holds and IMHO is
relevant. I kindly invite you that, if you agree, begin drawing with me the
possible rules for addressing all the points that you mentioned.


>
> 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.
>

Despite I was a gcc maintainer in the past, I don't have the resources for
a full fledged implementation of this (specially since I mostly maintained
the ARM backend). Nevertheless, I'll see what I can do with a plugin to get
a proof-of-concept by using a template class to mimick the semantic of a
template namespace. My initial idea is that the original template will be
translated by the plugin as a base class, and the extensions as derived
classes in a fixed order of inheritance.
But please, still consider my call for help while I manage to try a plugin
like this.

Thanks,

   Daniel.


>
> 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
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/.

--bcaec52beba5b2dc0304f0d49670
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 Sun, Jan 19, 2014 at 3:16 PM, Andrew Tomazos <span dir=3D"ltr">&=
lt;<a href=3D"mailto:andrewtomazos@gmail.com" target=3D"_blank">andrewtomaz=
os@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></blockquote><div><br></div><div>I understand that, in terms of a sta=
ndard, all these considerations have to be taken into account. That&#39;s w=
hy I call for help here. Please note that the very concrete problem I&#39;m=
 referring to still holds and IMHO is relevant. I kindly invite you that, i=
f you agree, begin drawing with me the possible rules for addressing all th=
e points that you mentioned.</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><br><=
/div><div>The best approach for this type of feature would be to put togeth=
er an experimental compiler extension to gcc or clang that implements templ=
ate 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>Despite I was a gcc maintainer in th=
e past, I don&#39;t have the resources for a full fledged implementation of=
 this (specially since I mostly maintained the ARM backend). Nevertheless, =
I&#39;ll see what I can do with a plugin to get a proof-of-concept by using=
 a template class to mimick the semantic of a template namespace. My initia=
l idea is that the original template will be translated by the plugin as a =
base class, and the extensions as derived classes in a fixed order of inher=
itance.</div>
<div>But please, still consider my call for help while I manage to try a pl=
ugin like this.</div><div><br></div><div>Thanks,</div><div><br></div><div>=
=C2=A0 =C2=A0Daniel.</div><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 class=3D"h5"><div><br></div><div>On Sunday, Janu=
ary 19, 2014 6:26:57 PM UTC+1, dgutson . wrote:<blockquote class=3D"gmail_q=
uote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddin=
g-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><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><span class=3D"HOEnZb"><font color=3D"=
#888888">

<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>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r>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 argument?<br>Who never shows a b=
it of temperament?<br>
Who&#39;s never wrong but always right?<br>Who&#39;d never dream of startin=
g a fight?<br>Who get stuck with all the bad 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 />

--bcaec52beba5b2dc0304f0d49670--

.
