A tiny proposal: extend namespace grammar for more convenience.

94 views
Skip to first unread message

germa...@gmail.com

unread,
Apr 7, 2014, 2:27:57 PM4/7/14
to std-pr...@isocpp.org
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

Sean Middleditch

unread,
Apr 7, 2014, 3:15:44 PM4/7/14
to std-pr...@isocpp.org, germa...@gmail.com
Reply all
Reply to author
Forward
0 new messages