Clay language

sybrandy sybrandy at gmail.com
Wed Dec 29 04:53:34 PST 2010


On 12/28/2010 12:37 PM, Andrej Mitrovic wrote:
> 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;

I do like this and I did think about this for a different reason: 
avoiding long/obnoxious module names.  (E.g. Java-like)  However, this 
is another good reason to use this feature.

Casey


More information about the Digitalmars-d mailing list