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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 06:11:47 PST 2016


On 12/14/16 2:17 AM, Jacob Carlborg wrote:
> On 2016-12-14 03:23, Andrei Alexandrescu wrote:
>> On 12/13/16 9:22 PM, Hatem Oraby wrote:
>
>>> with(import std.range)
>>> bool equal(R1, R2) if (isInputRange!R1 && isInputRange!R2)
>>> { ... }
>>
>> I considered this, then figured with is superfluous. -- Andrei
>
> It could allow to have a better control of the scope which the import
> affects, i.e.:
>
> with(import std.range)
> {
>   void foo(T) if (isInputRange!T)
>   void bar(T) if (isInputRange!T)
> }

Thanks for this suggestion.

* "with" is superfluous

* The grouping is not indicating that the import is effected only if one 
of the names is looked up

* I predict 90% of the time there will be one import per declaration, 
which takes it down to:

with (import std.range)
void foo(T) if (isInputRange!T) {}

which underlines the redundancy of the "with".


Andrei



More information about the Digitalmars-d mailing list