DIP11: Automatic downloading of libraries

Adam D. Ruppe destructionator at gmail.com
Tue Jun 14 18:34:40 PDT 2011


Nick Sabalausky:
> - By default, it ends up downloading an entire library one inferred
> source file at a time. Why? Libraries are a packaged whole.
> Standard behavior should be for libraries should be treated as
> such.

I don't agree. You don't import a library - you import a module.
It's natural to just download that module and get what you need
that way.

> Does every project that uses libX have to download it separately?

My approach is to download the libraries to a local subdirectory.

$ cd foo
$ dir
   app.d  # btw, app.d uses "import foo.bar;"
$ build app
$ dir
   app  app.o  app.d  foo/


If you want to share a library, you can link the local subdir
to a central lib dir using your operating system's features.
(symlinks, junctions, whatever)

I'm not sure what Andrei had in mind, but I like my approach
because it's easy to implement, clear to see what it is actually
doing, and packing your application for distribution is as simple
as zipping up the directory. Dependencies included automatically.

> It'll just grab it, no changes to your source needed at all, and
> any custom steps needed would be automatically handled

My approach again allowed a central repo, which may direct you
elsewhere using standard http.

It builds the default url by:

http://centraldomain.com/repository/package/module.d


I think the DIP should do this too if a liburl is not specified.


More information about the Digitalmars-d mailing list