new DIP14: Package import path association

Martin Nowak dawg at dawgfoto.de
Wed Oct 19 02:35:18 PDT 2011


On Wed, 19 Oct 2011 09:57:06 +0200, Jacob Carlborg <doob at me.com> wrote:

> On 2011-10-18 23:49, Jonathan M Davis wrote:
>> On Tuesday, October 18, 2011 00:38 Martin Nowak wrote:
>>> http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP14
>>
>> I really think that you lose something when you add file paths to  
>> imports
>> rather than letting the module system deal with it as it does now. The  
>> result
>> is messier, and I really don't think that it adds anything for the  
>> normal
>> case. I don't think that anything should be added to the language to  
>> support a
>> package manager without a _really_ good reason. It should be perfectly
>> possible to do package management without changing the language.
>>
>> - Jonathan M Davis
>
> One thing that would be nice is to be able, in the source code, somehow  
> add additional imports paths.
>
> But on the other hand, if this would be possible you would need to add  
> this to every source file that uses modules from those imports paths. Or  
> you would need a source file that basically just list new imports paths  
> which will be globally available. In the second case, I think a built  
> tool would be better and specify the import paths/packages in the build  
> script.
>

Yes these are the difficulties with the pragma(importpath) proposal.
Probably the scope of the pragma could be extended to all modules imported  
by that module,
with detecting collisions. That would make it more useful.

Attaching the import paths to module and package symbols allows to control
the visibility and scope in a more common way.
I agree though that string file paths are unwanted for import,
it just make no sense to restrict this to urls.

Anyhow this problem must not be solved now, it won't arise before one
can use remote sources.

martin


More information about the Digitalmars-d mailing list