importing modules with non-identifier names

Adam D. Ruppe destructionator at gmail.com
Sat Oct 31 10:43:13 PDT 2009


On Sat, Oct 31, 2009 at 12:21:31PM -0500, Andrei Alexandrescu wrote:
> Has anyone been irked by this? 

Yes, quite a bit. I tend to use names-like-this whenever I'm allowed,
which includes the filesystem. Of course, it is easy enough to rename
the file when doing D.

> One way to circumvent that may be
> 
> import fifth = "5th-element.d";
> 
> i.e., specify the file as a string and assign to it a regular D 
> identifier. Probably similar things have been discussed in the past, 
> what's the general impression?

I could live with that, but it doesn't seem to work with folders. Let's say
I had one called "game-api" with a file inside named "main.d".

Would you do something like this:

import gameapi.main = "game-api/main.d";

How would that work with the include path?

What about:

import whatever = "../folder/file.d";

If that was allowed, I'd expect imports to turn into a bit of a mess. Instead
of bugging with the -I, you'd just = ".../..." most everything.

Then, what about .di files?




While I'm irked by the dash import not working, I think the fix here would
have more weird corner cases to deal with than is worth it. It is easier to
just keep it how it is.

> 
> 
> Andrei

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list