Clay language

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Dec 28 09:37:37 PST 2010


On 12/28/10, Adam Ruppe <destructionator at gmail.com> wrote:
> That's not the only bad part. It also means refactoring your modules
> requires changes to the user code too. See my other post here:

Actually, D is equipped to solve even that problem. If you really want
to use fully qualified names and reserve the right to rename a module,
you can do this:

foo.d:
import std.stdio : writeln;
void bar()
{
    writeln("bar");
}

main.d:
static import foo = foo;
void main()
{
    foo.bar();
}

If you decide to rename the foo module to "foobar", all you need to
change is one line in main:
static import foo = foobar;

This is much saner than bearophile's "force full qualified names by
default", since it still allows you to refactor your modules with the
minimum amount of changes in the importing code.


More information about the Digitalmars-d mailing list