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

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 09:48:29 PST 2016


On Wednesday, 14 December 2016 at 17:24:42 UTC, Andrej Mitrovic 
wrote:
> On Wednesday, 14 December 2016 at 17:09:44 UTC, ketmar wrote:
>>> bool equal(R1, R2) : std.range, std.traits
>>> if (isInputRange!R1 && isInputRange!R2 && isArray!R2)
>>> { ... }
>>
>> breaks possible selective import. if both modules exports some 
>> symbol, we will need to selectively import and/or rename it.
>
> Not necessarily. The first colon is the only special case, 
> afterwards you can use all forms of imports:
>
>>> bool equal(R1, R2) : std.range : isInputRange, Trait = 
>>> std.traits
>>> if (isInputRange!R1 && isInputRange!R2 && Trait.isArray!R2)
>>> { ... }

i know that C school likes to add punctuation everywhere ;-), but 
i can't see why that is better than:

bool equal(R1, R2) import(std.range : isInputRange, Trait = 
std.traits) if ...

i think that the version with explicit keyword is easier to read.


More information about the Digitalmars-d mailing list