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

Seb via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 18:21:53 PST 2016


On Wednesday, 14 December 2016 at 20:16:29 UTC, Andrei 
Alexandrescu wrote:
> On 12/14/2016 03:13 PM, bitwise wrote:
>> I think the DIP indicated you may have considered this, but 
>> why not just
>> remove the requirement of 'static import ..' for using fully 
>> qualified
>> names?
>>
>> struct Buffered(Range) if (std.range.isInputRange!Range)
>> {
>>     import std.range;
>>     // ...
>> }
>>
>> You could then simply qualify any parameters or constraints 
>> and use
>> local imports for the body.
>
> We'd like people and simplistic tools such as grep to indicate 
> quickly where imports are present. -- Andrei

 From all ideas I read so far, this is my favorite. It's a really 
concise syntax.

What is the use case for using "grep" to find all imports? Even 
for something simplistic as to find all unittest blocks, one 
already needs to use Dscanner, so I don't see why this is a 
problem. Just image this case for "grep":

import std.algorithm,
std.range,
std.traits;

Moreover for a list of all imports, there is already a dedicated 
flag in DMD (-deps).


More information about the Digitalmars-d mailing list