[Issue 453] New: When importing modules compiler can not distinguish between directory and file

Aarti_pl aarti at interia.pl
Wed Oct 25 01:48:22 PDT 2006


Chris Nicholson-Sauls napisał(a):
> d-bugmail at puremagic.com wrote:
>> http://d.puremagic.com/issues/show_bug.cgi?id=453
>>
>>            Summary: When importing modules compiler can not distinguish
>>                     between directory and file
>>            Product: D
>>            Version: 0.169
>>           Platform: Other
>>         OS/Version: All
>>             Status: NEW
>>           Severity: normal
>>           Priority: P2
>>          Component: DMD
>>         AssignedTo: bugzilla at digitalmars.com
>>         ReportedBy: aarti at interia.pl
>>
>>
>> ....
>>
>> It cause problems when there is same name of file as a name of directory.
>>
>> E.g. Directory:
>> doost/program_options/a.d
>> doost/program_options/b.d
>> doost/program_options/c.d
>> doost/program_options.d
>>
>> Program:
>> import doost.program_options;
>>
>> Above cause error, although it is easy to see that I mean file not a 
>> directory
>> (AFAIK last part of import is always file).
>>
>> It's quite a basic problem, so I thing it should be corrected in the 
>> first
>> place. It causes unnecessary problems when porting code from C++ and 
>> disallows
>> creating program directory structure in the way designer wants.
>>
>>
> 
> This has come up many times before, and unless Walter has had a severe 
> change of heart (and some genius insights) it won't be changing.  
> Allowing modules and packages to share a name introduces all manner of 
> namespacing conflicts and ambiguities... effectively, imports break down 
> entirely (particularly if any more naming conflicts occur deeper into 
> the namespacing).
> 
> -- Chris Nicholson-Sauls


I am not trying to enforce anything - maybe it's really not good to 
include such a feature to compiler - I don't try to solve this problem.

But if current status quo must be kept, it should be clearly stated in 
documentation with short explanation (rationale), as it is quite 
restrictive.

I am writing from the "still newbie" position (only one year looking at 
D newsgroup), so I am sure that this issue will continuously come back 
later, when new people will give a try to D Language.

Regards
Marcin Kuszczak
Aarti_pl



More information about the Digitalmars-d-bugs mailing list