DIP10005: Dependency-Carrying Declarations is now available for community feedback

Meta via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 19:26:24 PST 2016


On Tuesday, 13 December 2016 at 22:33:24 UTC, Andrei Alexandrescu 
wrote:
> Destroy.
>
> https://github.com/dlang/DIPs/pull/51/files
>
>
> Andrei

What's the main goal with this proposal? Is it to introduce DCDs 
into the language or is it to clean up some warts of the local 
import pattern, i.e.:

int doSomething(T)(T t) //std.range is lazily imported but
{                       //can't be used in the signature
     import std.range;
     //...
}

struct Test(R) //Ditto
{
     import std.algorithm;
     //etc...
}

I'm assuming it's the former, or there wouldn't be any talk about 
introducing any new syntax. Imports would just be made completely 
lazy and we wouldn't have to change the language at all 
otherwise. So other than the fact that you can move the 
declaration anywhere without breaking it due to missing imports, 
are the advantages that DCDs provide really worth it enough to 
introduce yet another clause that can be put on any declaration? 
Especially when we have another solution (lazy imports) that does 
exactly what you want but excludes the DCD aspect?


More information about the Digitalmars-d mailing list