How to let D's one module contains lots of classes.
tcak via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 9 07:40:51 PST 2014
On Sunday, 9 November 2014 at 13:17:37 UTC, AlanThinker wrote:
> On Sunday, 9 November 2014 at 12:21:28 UTC, tcak wrote:
>
> 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;
> }
>
> ###############
That's good, but there is no need to add a new keyword as
"partial" for module I think. If compiler would just merge same
modules together automatically, that would do it.
More information about the Digitalmars-d
mailing list