<div dir="ltr">how about this:<div><br></div><div>variant 1 // currently legal D; just need to attach semantics</div><div><br></div><div>```</div><div>// applies to all below</div><div><div>@deps!({import std.stdio; pragma(lib, "curl"); }):</div></div><div><br></div><div><div>// applies to 1 below</div><div></div></div><div><div>@deps!({import std.range})<br></div></div><div><div>void fun(T)(isInputRange!T){} // depends on both deps</div></div><div><br></div><div><div>void fun2(File file){} // depends on 1st deps ending with ':'<br></div></div><div><br></div><div>```</div><div><br></div><div>variant 2: //currently legal if not ending with ':' as above; less noisy syntax</div><div><div>@deps{import std.stdio; pragma(lib, "curl"); }</div></div><div>@deps{import std.stdio; pragma(lib, "curl"); }: // applies to all below<br></div><div><br></div><div>Advantages:</div><div><br></div><div>* no new syntax (just new semantics)</div><div>* no nesting inside {}</div><div>* allows grouping multiple declarations under a single set of imports</div><div>* `grep import` will still work unlike many of the existing proposals</div><div>* can use existing traits to query for such imports (eg getSymbolsByUDA) </div><div>* allows a more general solution (eg also handles `pragma(lib, "curl");` if we want that as well)</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 14, 2016 at 4:54 PM, ketmar via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>On Thursday, 15 December 2016 at 00:29:17 UTC, Chris M wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
For the "with" keyword, why is the import statement kept? Seems unnecessary to keep it.<br>
<br>
void process(File input) import std.stdio;<br>
struct Buffered(Range) if (isInputRange!Range)<br>
with (std.range)<br>
{<br>
...<br>
}<br>
</blockquote>
<br></span>
to not block future uses of such `with` syntax for different purposes. and (which is more important for me, for example) to make greping easier. and to keep `with` semantics: it should introduce scope over *existing* things. explicit `import` brings the module to the existance. choose any options you like. ;-)<br>
</blockquote></div><br></div></div>