DIP11: Automatic downloading of libraries

Steven Schveighoffer schveiguy at yahoo.com
Tue Jun 14 08:54:04 PDT 2011


On Tue, 14 Jun 2011 10:51:06 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 6/14/11 9:45 AM, Michel Fortin wrote:
>> On 2011-06-14 09:53:16 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> said:
>>
>>> http://www.wikiservice.at/d/wiki.cgi?LanguageDevel/DIPs/DIP11
>>
>> I disagree about the model where you specify URLs in source code.
>
> Why?

Because the location of software is not controllable by the builder.  For  
example, if the owner of the code decides to move his software, the user  
compiling code using that software is at his mercy.

Contrast that with import paths, where the user compiling is in control of  
the paths on his hard drive.

So essentially, code can "break" outside of your control, and the only  
recourse you have is to modify the source code (not a pleasant prospect  
for people who are not developers).

>
>> I'd suggest an alternative solution: If DMD finds a dmd.conf file at the
>> root of one of the -I directories, it uses the download parameters in
>> that file to download to populate the directory with modules as needed.
>> This would also apply to the current directory. The content of that
>> dmd.conf file could look like this:
>>
>> [module-download]
>> package.* = http://someserver.net/d-repo/latest/
>> otherpack.* = http://otherserver.net/d-repo/1.2/
>>
>> That way it's easy to understand what comes from where without having to
>> scan all your source code for pragmas.
>
> I agree this would be good to have, but not exclusively. The problem is  
> that anyone who wants to share some code must require potential users to  
> modify their config files, instead of offering them a key-ready solution.

Just unpack them?  I mean, there's no reason you can't install their code  
on your hard drive.  If you want to publish your code for others to use,  
you have three options:

1. provide a download.
2. provide a config line for people to add to their dmd.conf
2. put your code in a central repository (like dsource.org) that is  
already added to everyone's configuration by default.

What might be useful is a tool to allow simplified management of the  
sources, i.e.:

dmdpkg addsource http://...

I also think it would be nice to provide wildcards for centralized  
servers.  So that as packages are added to the server, you don't need to  
modify your rules.  For example, if someone adds a package to dsource,  
there should be a rule that allows people to publish the code without  
people having to add lines to their dmd.conf.  This might require some  
sort of metadata file system.

I really think this project needs more design work.

-Steve


More information about the Digitalmars-d mailing list