[Issue 17907] Can't automatically resolve to function with same name as module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 20 22:57:14 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17907

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
I'm not recommending to reopen, but just to be clear here, the issue is ONLY a
problem with top level packages and modules:

For example:

import std.stdio;

void std() {} // error
void stdio() {} // ok

This limits what you can name your top-level modules and packages, because any
time you import something, it defines the symbol in the importing. Public
imports don't do this. For example std.stdio publicly imports core.stdc.stdio.
But I can define a `core` function in the above example.

I know this is because of the rules, and I know that we want to keep things
simple. But consider that any library that defines a top-level module (probably
because the library is simple) is invading the namespace of whoever imports it.

It might be worth considering alternatives to how it's currently
designed/implemented, if only just for top-level modules/packages.

--


More information about the Digitalmars-d-bugs mailing list