DIP16: Transparently substitute module with package

deadalnix deadalnix at gmail.com
Wed Apr 4 00:20:53 PDT 2012


Le 03/04/2012 19:44, Martin Nowak a écrit :
> On Fri, 30 Mar 2012 16:46:19 +0200, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> Starting a new thread from one in announce:
>>
>> http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP16
>>
>> Please comment, after which Walter will approve. Walter's approval
>> means that he would approve a pull request implementing DIP16 (subject
>> to regular correctness checks).
>>
>>
>> Destroy!
>>
>> Andrei
>
> What about supporting package initalization?
> I basically proposed that if a submodule of a package
> was imported, a static import of the package is implicitly
> added.
> http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP15

That is pretty much what was proposed by people in this thread.

Basically, it boils down to adding automatically aliases with public 
imports.

I would prefer use pkg.d file instead of pkg/_.d (I though of it a lot 
recently, and this is what make more sense, even if not my initial 
proposal).

With pkg/package.d or pkg/_.d you can ends up with unnecessary 
complexity in choosing the file wich is imported, and create error 
cases. For instance :

What happen if both pkg.d and pkg/_.d exists ? If it is not in the same 
path (think -I compiler option). In one case, this is an issue, in the 
other this isn't.

This file convention solution is superior to the _.d one or package.d 
one. DIP15 is superior to D16 IMO.


More information about the Digitalmars-d mailing list