DIP11: Automatic downloading of libraries

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jun 14 09:44:51 PDT 2011


On 6/14/11 11:39 AM, Daniel Gibson wrote:
> Am 14.06.2011 18:35, schrieb Andrei Alexandrescu:
>> 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.)
>>
>> Andrei
>
> Hmm I thought somebody (possibly Walter) mentioned adding something to
> the compiler that makes this more easy (probably outputting all imports
> or all imports that are not in Phobos or something like that).
> Unfortunately my memory is to vague to find the corresponding message or
> to even remember what exactly was done - maybe somebody else remembers it?

That is actually possible only with multiple runs due to the 
transitivity issues. For example, module A tries to import module B and 
fails -> dmd outputs B. But then module B tries to import other modules, 
so a new run of dmd is needed etc.

This is not pernicious, but it definitely requires a nontrivial tool to 
handle all that.


Andrei


More information about the Digitalmars-d mailing list