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

Chris M. via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 13 18:54:30 PST 2016


On Wednesday, 14 December 2016 at 02:23:07 UTC, Andrei 
Alexandrescu wrote:
> On 12/13/16 8:53 PM, Chris M. wrote:
>> On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei 
>> Alexandrescu wrote:
>>
>>> I prefer the current form of the proposal:
>>>
>>> bool equal(R1, R2)
>>> import (std.range)
>>> if (isInputRange!R1 && isInputRange!R2)
>>> { ... }
>>>
>>> The point has been brought up that the syntax 
>>> import(std.range) is
>>> also used for string imports. It is a drawback.
>>>
>>>
>>> Andrei
>>
>> How about using "imports" instead of "import"? Simple enough 
>> change, and
>> it still makes sense
>>
>> bool equal(R1, R2)
>> imports (std.range)
>> if (isInputRange!R1 && isInputRange!R2)
>> { ... }
>
> I fear that (a) a lot of folks will believe "imports" is a 
> keyword; (b) another lot of folks will write "import" instead 
> of "imports" and wonder why it doesn't work. -- Andrei

Could use something like "using" or "with" instead of "import" 
then.

bool equal(R1, R2)
using(std.range)
if (isInputRange!R1 && isInputRange!R2)
{ ... }

Of course, the collision with the syntax for string imports might 
not be a huge deal anyway, since you could easily distinguish 
between when it's for a string import and when it's for a inline 
import just by the context you see it in. Leaving it as "import" 
would probably be fine too.


More information about the Digitalmars-d mailing list