phobos dependencies

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Dec 21 13:06:10 PST 2013


21-Dec-2013 21:10, Andrei Alexandrescu пишет:
> On 12/21/13 12:08 AM, Dmitry Olshansky wrote:
>> 21-Dec-2013 00:43, Martin Nowak пишет:

>>> 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)
>>> {
>>> }
>>>
>> That has the disadvantage of importing the whole std.range.
>
> Yah but only if the symbol foo is actually used.

That assuming static import becomes lazy (if/when).

In such a case I'd be against the idom still if only because of extra 
verbosity in constraints - it's a place where we'd want to have less of it.

Second point is that even if import becomes lazy it's still 
analyze-the-whole-module at the first reference required.

No escaping the fact that both constraints and bodies of templates 
function need to use fine grained imports (more . The more can be 
shifted inside of the body, and the more specific it gets the better 
dependency management we have. The latter implies the well-known benefit 
of having less stuff to analyze, compile and link.

Thus I conclude that introducing lazy loading of symbols
accomplishes too little for the amount of changes it entails.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list