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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 09:29:27 PST 2016


On 12/14/2016 12:24 PM, Anonymouse wrote:
> On Wednesday, 14 December 2016 at 17:09:44 UTC, ketmar wrote:
>> On Wednesday, 14 December 2016 at 17:01:50 UTC, Andrej Mitrovic
>>>
>>> How about:
>>>
>>> bool equal(R1, R2) : std.range
>>> if (isInputRange!R1 && isInputRange!R2)
>>> { ... }
>>>
>>> It's nice and concise, and you could in theory also allow multiple
>>> imports with a comma
>>>
>>> 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.
>
> The with keyword then?
>
> bool equal(R1, R2)
> with (std.range : isInputRange, isOutputRange) && (std.stdio : writeln)
> && (std.algorithm)
> if (isInputRange!R1 && isInputRange!R2)
> { ... }

The "import" keyword must be used. -- Andrei



More information about the Digitalmars-d mailing list