phobos dependencies
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Jan 5 20:26:05 PST 2014
On 1/5/14 5:22 PM, Martin Nowak wrote:
> On 12/20/2013 09:43 PM, Martin Nowak wrote:
>>
>> Couldn't static imports be made lazy without breaking any code?
>> The above example would read.
>>
>> static import std.range.
>>
>> void foo(R)(R range) if (std.range.isForwardRange!R)
>> {
>> }
>
> Furthermore selective import can always be made lazily without changing
> code.
>
> import std.algorithm : min;
>
> Only if `min` or `std.algorithm` are used the compiler needs to open
> std.algorithm.
I thought more about this and I think that's wrong. Making all imports
lazy would be a net large win.
The missing link is transitivity: if one imports only min from
std.algorithm, std.algorithm itself indeed needs to be opened and
parsed, but ONLY transitive imports of std.algorithm that min itself
needs would be opened.
We can do lazy importing with no change to the language semantics.
Andrei
More information about the Digitalmars-d
mailing list