DIP16: Transparently substitute module with package

Timon Gehr timon.gehr at gmx.ch
Fri Mar 30 08:32:31 PDT 2012


On 03/30/2012 04:46 PM, Andrei Alexandrescu 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


Those are two proposals.

I think the first one should be implemented.


I don't really like the second one.

1. It is an over-general solution, because it does not solve a general 
problem.

2. Library writers lose control. All symbol names in the package are 
reserved when the package is deployed. It will be a breaking change to 
introduce a sub-package that happens to have the same name as some 
symbol defined in any module in the same package hierarchy.

3. symbol lookup is already hard enough to get right, because compile 
time reflection and conditional code generation can introduce 
ambiguities and contradictions. DMD does not get it right. It is likely 
that this change would make fixing this in a general but 
not-too-conservative way considerably harder.


Maybe it would be better to just interpret foo.bar.baz as 
foo.bar.package.baz if foo.bar is a package that has been imported via 
the foo.bar.package rewrite? Of course, issue 2 probably would remain.


More information about the Digitalmars-d mailing list