On Thursday, 15 December 2016 at 01:59:33 UTC, Timothee Cour wrote:
how about this:

variant 1 // currently legal D; just need to attach semantics

```
// applies to all below
@deps!({import std.stdio; pragma(lib, "curl"); }):

// applies to 1 below
@deps!({import std.range})
void fun(T)(isInputRange!T){} // depends on both deps

void fun2(File file){}  // depends on 1st deps ending with ':'

```

variant 2: //currently legal if not ending with ':' as above; less noisy
syntax
@deps{import std.stdio; pragma(lib, "curl"); }
@deps{import std.stdio; pragma(lib, "curl"); }: // applies to all below

Advantages:

* no new syntax (just new semantics)
* no nesting inside {}
* allows grouping multiple declarations under a single set of imports * `grep import` will still work unlike many of the existing proposals * can use existing traits to query for such imports (eg getSymbolsByUDA) * allows a more general solution (eg also handles `pragma(lib, "curl");` if
we want that as well)

Really nice idea! Except it's still a little noisy. I would be really happy if this gets accepted...

Reply via email to