Topic: Generalizing the concept of name spaces


Author: corentin.schreiber@cea.fr
Date: Thu, 23 Oct 2014 14:02:00 -0700 (PDT)
Raw View
------=_Part_1144_1894319520.1414098120724
Content-Type: text/plain; charset=UTF-8

I am wondering if it would be possible to extend the notion of "name space"
to C++ constructs which are not stricly speaking C++ namespaces (as in
"namespace std {}"), but that do carry a name space with them: classes,
structs and enums.
It seems strange that you cannot manipulate these name spaces like you
could for regular namespaces.
The idea would be to allow importing the scope of classes, structs and
enums using the "using namespace" syntax, as well as enabling ADL (I do not
know if the latter would be a mistake or if it would actually allow new
interesting constructs).

I cannot seem to post my code examples using the google group interface, so
I have uploaded them here:
https://github.com/cschreib/cpp/blob/master/namespace/namespace.md

There are all the examples I can think of right now, but I'm convinced
others can end up with more interesting potential applications. Although
cases 1 and 3 are cosmetic (we can do the same without the proposal, just
with more verbose code), case 2 actually brings something new, as
specifying all the imported types by hand will not allow automatic
importing if the wrapped type (here std::vector<T>) is modified later on.

If you have other ideas of what could be done with such a feature, or if
you see dangerous side effects, please share.

--

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

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

<div dir=3D"ltr">I am wondering if it would be possible to extend the notio=
n of "name space" to C++ constructs which are not stricly speaking C++ name=
spaces (as in "namespace std {}"), but that do carry a name space with them=
: classes, structs and enums.<br>It seems strange that you cannot manipulat=
e these name spaces like you could for regular namespaces.<br>The idea woul=
d be to allow importing the scope of classes, structs and enums using the "=
using namespace" syntax, as well as enabling ADL (I do not know if the latt=
er would be a mistake or if it would actually allow new interesting constru=
cts).<br><br>I cannot seem to post my code examples using the google group =
interface, so I have uploaded them here:<br>https://github.com/cschreib/cpp=
/blob/master/namespace/namespace.md<br><br>There are all the examples I can=
 think of right now, but I'm convinced others can end up with more interest=
ing potential applications. Although cases 1 and 3 are cosmetic (we can do =
the same without the proposal, just with more verbose code), case 2 actuall=
y brings something new, as specifying all the imported types by hand will n=
ot allow automatic importing if the wrapped type (here std::vector&lt;T&gt;=
) is modified later on.<br><br>If you have other ideas of what could be don=
e with such a feature, or if you see dangerous side effects, please share.<=
br></div>

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

------=_Part_1144_1894319520.1414098120724--

.


Author: contact@ncomputers.org
Date: Thu, 23 Oct 2014 14:17:37 -0700 (PDT)
Raw View
------=_Part_685_501368368.1414099057790
Content-Type: text/plain; charset=UTF-8

I think that you proposals are good!

Am Donnerstag, 23. Oktober 2014 16:02:00 UTC-5 schrieb corentin....@cea.fr:
>
> I am wondering if it would be possible to extend the notion of "name
> space" to C++ constructs which are not stricly speaking C++ namespaces (as
> in "namespace std {}"), but that do carry a name space with them: classes,
> structs and enums.
> It seems strange that you cannot manipulate these name spaces like you
> could for regular namespaces.
> The idea would be to allow importing the scope of classes, structs and
> enums using the "using namespace" syntax, as well as enabling ADL (I do not
> know if the latter would be a mistake or if it would actually allow new
> interesting constructs).
>
> I cannot seem to post my code examples using the google group interface,
> so I have uploaded them here:
> https://github.com/cschreib/cpp/blob/master/namespace/namespace.md
>
> There are all the examples I can think of right now, but I'm convinced
> others can end up with more interesting potential applications. Although
> cases 1 and 3 are cosmetic (we can do the same without the proposal, just
> with more verbose code), case 2 actually brings something new, as
> specifying all the imported types by hand will not allow automatic
> importing if the wrapped type (here std::vector<T>) is modified later on.
>
> If you have other ideas of what could be done with such a feature, or if
> you see dangerous side effects, please share.
>

--

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

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

<div dir=3D"ltr">I think that you proposals are good!<br><br>Am Donnerstag,=
 23. Oktober 2014 16:02:00 UTC-5 schrieb corentin....@cea.fr:<blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;"><div dir=3D"ltr">I am wondering if it would =
be possible to extend the notion of "name space" to C++ constructs which ar=
e not stricly speaking C++ namespaces (as in "namespace std {}"), but that =
do carry a name space with them: classes, structs and enums.<br>It seems st=
range that you cannot manipulate these name spaces like you could for regul=
ar namespaces.<br>The idea would be to allow importing the scope of classes=
, structs and enums using the "using namespace" syntax, as well as enabling=
 ADL (I do not know if the latter would be a mistake or if it would actuall=
y allow new interesting constructs).<br><br>I cannot seem to post my code e=
xamples using the google group interface, so I have uploaded them here:<br>=
<a href=3D"https://github.com/cschreib/cpp/blob/master/namespace/namespace.=
md" target=3D"_blank" onmousedown=3D"this.href=3D'https://www.google.com/ur=
l?q\75https%3A%2F%2Fgithub.com%2Fcschreib%2Fcpp%2Fblob%2Fmaster%2Fnamespace=
%2Fnamespace.md\46sa\75D\46sntz\0751\46usg\75AFQjCNEvjONv1xeBOUBrDLYrCQthu7=
FANw';return true;" onclick=3D"this.href=3D'https://www.google.com/url?q\75=
https%3A%2F%2Fgithub.com%2Fcschreib%2Fcpp%2Fblob%2Fmaster%2Fnamespace%2Fnam=
espace.md\46sa\75D\46sntz\0751\46usg\75AFQjCNEvjONv1xeBOUBrDLYrCQthu7FANw';=
return true;">https://github.com/cschreib/<wbr>cpp/blob/master/namespace/<w=
br>namespace.md</a><br><br>There are all the examples I can think of right =
now, but I'm convinced others can end up with more interesting potential ap=
plications. Although cases 1 and 3 are cosmetic (we can do the same without=
 the proposal, just with more verbose code), case 2 actually brings somethi=
ng new, as specifying all the imported types by hand will not allow automat=
ic importing if the wrapped type (here std::vector&lt;T&gt;) is modified la=
ter on.<br><br>If you have other ideas of what could be done with such a fe=
ature, or if you see dangerous side effects, please share.<br></div></block=
quote></div>

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

------=_Part_685_501368368.1414099057790--

.


Author: walter1234 <walter2bz@gmail.com>
Date: Fri, 31 Oct 2014 01:59:33 -0700 (PDT)
Raw View
------=_Part_1512_1349650374.1414745973704
Content-Type: text/plain; charset=UTF-8

Agree totally.
there are existing hazards when you use nested classes - some people
discourage them - but no one discourages namespacing.

So indeed , i think it should be completely generalised, along with the
UFCS proposal

Some people have suggested that namespaces should also be able to take
template parameters

On Thursday, 23 October 2014 22:02:00 UTC+1, corentin....@cea.fr wrote:
>
> I am wondering if it would be possible to extend the notion of "name
> space" to C++ constructs which are not stricly speaking C++ namespaces (as
> in "namespace std {}"), but that do carry a name space with them: classes,
> structs and enums.
> It seems strange that you cannot manipulate these name spaces like you
> could for regular namespaces.
> The idea would be to allow importing the scope of classes, structs and
> enums using the "using namespace" syntax, as well as enabling ADL (I do not
> know if the latter would be a mistake or if it would actually allow new
> interesting constructs).
>
> I cannot seem to post my code examples using the google group interface,
> so I have uploaded them here:
> https://github.com/cschreib/cpp/blob/master/namespace/namespace.md
>
> There are all the examples I can think of right now, but I'm convinced
> others can end up with more interesting potential applications. Although
> cases 1 and 3 are cosmetic (we can do the same without the proposal, just
> with more verbose code), case 2 actually brings something new, as
> specifying all the imported types by hand will not allow automatic
> importing if the wrapped type (here std::vector<T>) is modified later on.
>
> If you have other ideas of what could be done with such a feature, or if
> you see dangerous side effects, please share.
>

--

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

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

<div dir=3D"ltr">Agree totally.<div>there are existing hazards when you use=
 nested classes - some people discourage them - but no one discourages name=
spacing.</div><div><br></div><div>So indeed , i think it should be complete=
ly generalised, along with the UFCS proposal</div><div><br></div><div>Some =
people have suggested that namespaces should also be able to take template =
parameters</div><div><br>On Thursday, 23 October 2014 22:02:00 UTC+1, coren=
tin....@cea.fr  wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">I am wondering if it would be possible to extend the notion of "na=
me space" to C++ constructs which are not stricly speaking C++ namespaces (=
as in "namespace std {}"), but that do carry a name space with them: classe=
s, structs and enums.<br>It seems strange that you cannot manipulate these =
name spaces like you could for regular namespaces.<br>The idea would be to =
allow importing the scope of classes, structs and enums using the "using na=
mespace" syntax, as well as enabling ADL (I do not know if the latter would=
 be a mistake or if it would actually allow new interesting constructs).<br=
><br>I cannot seem to post my code examples using the google group interfac=
e, so I have uploaded them here:<br><a href=3D"https://github.com/cschreib/=
cpp/blob/master/namespace/namespace.md" target=3D"_blank" onmousedown=3D"th=
is.href=3D'https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fcschre=
ib%2Fcpp%2Fblob%2Fmaster%2Fnamespace%2Fnamespace.md\46sa\75D\46sntz\0751\46=
usg\75AFQjCNEvjONv1xeBOUBrDLYrCQthu7FANw';return true;" onclick=3D"this.hre=
f=3D'https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fcschreib%2Fc=
pp%2Fblob%2Fmaster%2Fnamespace%2Fnamespace.md\46sa\75D\46sntz\0751\46usg\75=
AFQjCNEvjONv1xeBOUBrDLYrCQthu7FANw';return true;">https://github.com/cschre=
ib/<wbr>cpp/blob/master/namespace/<wbr>namespace.md</a><br><br>There are al=
l the examples I can think of right now, but I'm convinced others can end u=
p with more interesting potential applications. Although cases 1 and 3 are =
cosmetic (we can do the same without the proposal, just with more verbose c=
ode), case 2 actually brings something new, as specifying all the imported =
types by hand will not allow automatic importing if the wrapped type (here =
std::vector&lt;T&gt;) is modified later on.<br><br>If you have other ideas =
of what could be done with such a feature, or if you see dangerous side eff=
ects, please share.<br></div></blockquote></div></div>

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

------=_Part_1512_1349650374.1414745973704--

.