DIP11: Automatic downloading of libraries

Steven Schveighoffer schveiguy at yahoo.com
Tue Jun 14 11:58:17 PDT 2011


On Tue, 14 Jun 2011 12:35:44 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 6/14/11 11:32 AM, Graham Fawcett wrote:
>> On Tue, 14 Jun 2011 15:59:15 +0000, Adam D. Ruppe wrote:
>>
>>>> One other interesting aspect is that the string literal can be
>>>> CTFE-constructed,
>>>
>>> Oh, or it could be in version {} blocks. I like that.
>>>
>>> I think we should actually whip up a working model. It needn't be a
>>> compiler feature at this point - we can use pragma(msg, "BUILD: " ~
>>> param) for now and have a helper program scan dmd's output.
>>
>> +1, sounds fun. :)
>>
>> Rather than pragma(msg), you could also use pragma(liburl), and run dmd
>> with "-ignore -v". You can parse the pragma from there. (I think you'd
>> need to write `pragma(liburl, "name-in-quotes", "url-in-quotes")`, a
>> slight diversion from Andrei's syntax, but otherwise it would work.)
>>
>> Graham
>
> I just realized that one advantage of the download being integrated in  
> the compiler is that the compiler is the sole tool with full knowledge  
> and control of what modules are imported. A tool could repeatedly run  
> the compiler with -v and see what modules it couldn't load, to then  
> download them. (Also, of course, a tool could rely on extralinguistic  
> library management control that has its own advantages and disadvantages  
> as we discussed.)

I think it should be split as follows:

dmd: determine *what* to download (i.e. I need to import module x.y.z)
external tool: determine *where* and *how* to download it. (i.e. module  
x.y.z lives on http://somerepository.org/x, go get it and save it)

The advantages being:

1. there exists umpteen billion already-existing tools that fetch and  
install data over the network
2. dmd does not contain parts that have nothing to do with compiling,  
which could potentially screw up the compiling part.
3. Depending on the tool language, the barrier to development of it would  
be significantly reduced.  Most people feel quite uncomfortable messing  
with compiler source code, but have no problems editing something like a  
shell script, or even a simple d-based tool.
4. The compiler is written in C++, and hence so would the part that does  
this have to be... yuck!

-Steve


More information about the Digitalmars-d mailing list