On Sunday, 9 November 2014 at 12:21:28 UTC, tcak wrote:
On Sunday, 9 November 2014 at 11:30:22 UTC, AlanThinker wrote:
Yes, you are right.
Package can do it.
Thanks all of you!

Yes, package can do it, thou this adds burden to maintain packages this time. Weirdness of this design is seen in druntime as well.

core.sync.mutex.Mutex

Doubling mutex word unnecessarily. Every time I will create a module, half an hour, I am thinking what name to give the module. Either will create many classes in one file, or use same name for both module and class that causes above example.

If we can create partial module, it will be easier to use. then no package needed.
such as:

################
// test/foo/gui/button.d
partial module foo.gui;

class Button
{
    public this() {
        import std.stdio : writeln;
        writeln( "New Button!" );
    }
}
// test/foo/gui/widget.d
partial module foo.gui;

class Widget {
    public this() {
        import std.stdio : writeln;
        writeln( "New Widget!" );
    }
}

// test/foo/namespace.d
module namespace;

import foo.gui;

void main()
{
    auto w = new foo.gui.Widget;
    auto b = new foo.gui.Button;
}

###############

Reply via email to