Topic: A tiny proposal: extend namespace grammar for more convenience.


Author: germandiago@gmail.com
Date: Mon, 7 Apr 2014 11:27:57 -0700 (PDT)
Raw View
------=_Part_1052_5062500.1396895277140
Content-Type: text/plain; charset=UTF-8

Hello,

Rationale: Using nested namespaces with the need to open several sets of
brackets just contributes to more
noise without any gain. Sometimes we just want to open a namespace to add
functions/classes, etc that
are nested in two or three namespaces, like this:

namespace hello {

namespace my {

namespace world {

}

}

}

In C# you can write:

namespace Hello.My.World {

}


I think it would be a natural extension to allow:

namespace hello::my::world {

}

to be the exact equivalent of

namespace hello {
namespace my {
namespace world {

}

}

}

This would elminate some annoying bracket matching and I don't think
(I am no expert) that its implementation would be difficult.

As in C#, no namespace needs to exist previously to use that syntax.

Regards

--

---
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_1052_5062500.1396895277140
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>Rationale: Using nested namespac=
es with the need to open several sets of brackets just contributes to more<=
/div><div>noise without any gain. Sometimes we just want to open a namespac=
e to add functions/classes, etc that</div><div>are nested in two or three n=
amespaces, like this:</div><div><br></div><div><div>namespace hello {</div>=
<div><br></div><div>namespace my {</div><div><br></div><div>namespace world=
 {</div><div><br></div><div>}</div><div><br></div><div>}</div></div><div><b=
r></div><div>}</div><div><br><div>In C# you can write:</div><div><br></div>=
<div>namespace Hello.My.World {</div><div><br></div><div>}</div><div><br></=
div><div><br></div><div>I think it would be a natural extension to allow:</=
div></div><div><br></div><div>namespace hello::my::world {</div><div><br></=
div><div>}</div><div><br></div><div>to be the exact equivalent of</div><div=
><br></div><div>namespace hello {</div><div>namespace my {</div><div>namesp=
ace world {</div><div><br></div><div>}</div><div><br></div><div>}</div><div=
><br></div><div>}</div><div><br></div><div>This would elminate some annoyin=
g bracket matching and I don't think</div><div>(I am no expert) that its im=
plementation would be difficult.</div><div><br></div><div>As in C#, no name=
space needs to exist previously to use that syntax.</div><div><br></div><di=
v>Regards</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_1052_5062500.1396895277140--

.