On Sunday, 27 April 2014 at 08:16:58 UTC, Andrej Mitrovic via Digitalmars-d wrote:
On 4/27/14, Dicebot via Digitalmars-d <[email protected]> wrote:
Using named mixin templates for pure scope resolution is side
effect and should be discouraged in any reasonable code.

There's also the un-instantiable class trick:

-----
final abstract class Scope
{
static:
}
-----

A struct-based version is also possible. It's used in Phobos and other libraries. There's a need for scoping symbols other than in modules, but I'm not a fan of pushing C++ features in D. Not unless we have a
really solid DIP.

I believe this is a temporary workaround. Once bugs and deficiencies of existing module system will be taken care of, there won't be any need in using namespace emulation.

Idealism aside, modules have some implementation issues right now which force people to use workarounds like named mixins or the above trick, e.g. package access not being propagated up/down a hierarchy.

This pops up very often so I have just went and implemented proof of concept for package(pkg1.pkg2.pkg3) protection attribute syntax. Was relatively straightforward, will do a PR soon-ish after some cleanup.

Reply via email to