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

Yuxuan Shui via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 00:43:09 PST 2016


On Wednesday, 14 December 2016 at 08:16:56 UTC, Suliman wrote:
> On Wednesday, 14 December 2016 at 07:17:57 UTC, 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)
>> }
>
> Look very nice!

If this looks nice to you then I would like to propose:

@import("std.range"):
void foo(T) if (isInputRange!T)

And:

@import("std.range")
{
   void foo(T) if (isInputRange!T)
   void bar(T) if (isInputRange!T)
}

In my eye this whole thing fits really well into the property 
syntax. Yes, it's a little strange to pass module name as string. 
Otherwise it's perfect.

Maybe we can allow properties to take symbol as argument?


More information about the Digitalmars-d mailing list