On Friday, 16 December 2016 at 00:53:14 UTC, Timothee Cour wrote:
one more thing:

we can simplify further (while still having formatted looking code) with
!q{} instead of !() :

```
// applies to next decl
@deps!q{import std.algorithm;}
void test1(){}

// applies to a set of decls
@deps!q{import std.stdio;}{
  void test2(){}
  void test3(){}
}

// applies to all following decls (':')
@deps!q{import std.array;}:

q{} would suggest the argument is a string, right? Plus, why does deps have to be a template?


// can specify other dependencies beyond imports and have arbitrary complex
logic:
@deps!q{
  import std.range;
  static int[100] data2;
  version(linux){
    enum data1=import("foo");//string import
    pragma(lib, "curl");
  }
}:

This is unnecessarily powerful.

void test4(){}

// Can alias some dependencies:
alias deps1=deps!q{import std.algorithm;};

@deps1
void test4(){}

I would prefer my @import alternative. If we make use of q{}, it would look fine too:

@import(q{std.file: File}) @import(q{std.range: isInputRange})
void foo(T)(File x) if (isInputRange!T);

```



On Thu, Dec 15, 2016 at 3:46 PM, ArturG via Digitalmars-d < [email protected]> wrote:

[...]

Reply via email to