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

Jon Degenhardt via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 13 19:37:12 PST 2016


On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei 
Alexandrescu wrote:
> I prefer the current form of the proposal:
>
> bool equal(R1, R2)
> import (std.range)
> if (isInputRange!R1 && isInputRange!R2)
> { ... }
>
I didn't see an example of the syntax when multiple imports are 
involved (apologies if I missed it). Would be good to spell it 
out. For example, the start to uninitializedArray (array.d):

     auto uninitializedArray(T, I...)(I sizes) nothrow @system
     if (isDynamicArray!T && allSatisfy!(isIntegral, I) && 
hasIndirections!(ElementEncodingType!T))
     {

This uses imports from std.traits, std.meta, and std.range. Would 
there be one import statement or three? I'm guessing so the 
intent is one, so perhaps:

     auto uninitializedArray(T, I...)(I sizes) nothrow @system
     import (std.traits; std.meta; std.range)
     if (isDynamicArray!T && allSatisfy!(isIntegral, I) && 
hasIndirections!(ElementEncodingType!T))
     {

Is that the idea? Similarly for importing individual symbols. In 
the above case:

     auto uninitializedArray(T, I...)(I sizes) nothrow @system
     import (std.traits : hasIndirections, isDynamicArray, 
isIntegral;
             std.meta : allSatisfy;
             std.range : ElementEncodingType)
     if (isDynamicArray!T && allSatisfy!(isIntegral, I) && 
hasIndirections!(ElementEncodingType!T))
     {

--Jon


More information about the Digitalmars-d mailing list