DIP16: Transparently substitute module with package

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 30 11:42:55 PDT 2012


On Friday, March 30, 2012 20:06:57 Andrej Mitrovic wrote:
> On 3/30/12, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> > Destroy!
> 
> "That means a program that imports std.algorithm may use "std.sort"
> for the symbol "std.algorithm.sort"."
> 
> That's quite interesting. Would that also mean that you could do:
> import std.algorithm; // has indexOf
> import std.string; // has indexOf
> void main() {
> string.indexOf("foo", "foo"); -> std.string.indexOf
> }

No, I don't think so. If I understand the proposal correctly, it would enable 
std.indexOf (which doesn't help you at all in this case), not string.indexOf. 
It's trying to make it so that you can treat a symbol in a sub-module as it 
were in a higher module, and string.indexOf doesn't help with that at all.

- Jonathan M Davis


More information about the Digitalmars-d mailing list