phobos dependencies

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Dec 21 13:38:50 PST 2013


22-Dec-2013 01:16, Andrei Alexandrescu пишет:
> On 12/21/13 1:06 PM, Dmitry Olshansky wrote:
>> 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.
>
> That's why I'm saying: make all imports lazy!!!!

Unless language defines a way to tell apart and split off a group of 
declarations inside of a module as independent block laziness doesn't 
help any. The whole reason is to avoid analyzing the whole module and 
pulling in its globals. If lazy import can pull only pieces (per symbol 
dependencies) of module that are actually required - cool, but it's 
seems very distant possibility.

As it stands the only thing lazy buys us is "pay as you touch" contrary 
to "pay as you name the intent to touch". The problem is that the 
payment is for the whole stock of the said "shop". I see second problem 
(granularity of imports) as far more critical then the first (condition 
under which the pieces are imported). The second problem seems solvable 
within the current implementation, the first seems like it would need 
arbitrary amount of time to fix and gains are marginal.



-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list