new DIP14: Package import path association

Martin Nowak dawg at dawgfoto.de
Wed Oct 19 02:42:48 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.
Which is what I finally did.
https://github.com/dawgfoto/graphics/blob/master/src/graphics/_.d

Where the importpath pragma is simply appending to the -I list, thus had  
global scope.
The good thing about this is that it is decentral and recursive w.r.t. the  
imported sources.

> In the second case, I think a built tool would be better and specify the  
> import paths/packages in the build script.
>


More information about the Digitalmars-d mailing list