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

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 13:11:46 PST 2016


On Wednesday, 14 December 2016 at 14:11:47 UTC, Andrei 
Alexandrescu wrote:
> * 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".

Honestly, while I can see some value in what Jacob is suggesting, 
because it allows you to restrict some imports without repeating 
them, I think that the reality of the matter is that in practice, 
it would result in the imports just being at the top of the 
module - particularly when you consider that function signtaures 
are actually pretty far apart in most cases, since you have the 
function body (which is often not small), the unittest block, and 
the documentation for the next function, making it pretty ugly to 
wrap all of those in an import block.

- Jonathan M Davis


More information about the Digitalmars-d mailing list