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)
{ ... }

A problem with that is that it reads "bool equal with std.stdio if something", suggesting something decides whether or not to import std.stdio.

Reply via email to