__HERE__

monkyyy crazymonkyyy at gmail.com
Mon Jun 17 16:24:14 UTC 2024


most user written aliasSeq's are repetitive, yet simply nessery 
for metaprograming

```d
alias foo=...;
alias bar=...;
alias fizz=...;
alias foobar=__HERE__;//seq!(foo,bar,fizz)
alias bar=...;
```

`__HERE__` is a special token that evaluates to an alias seq of 
local symbols defined above it

---

```d

auto func1(){...}
auto func2(){...}
auto func3(){...}

static foreach(f;__HERE__){//contains func1, 2 and 3; not f
```

---

like other special tokens it evaluate to the call site

```d
template foo(alias bar=__HERE__){
   alias foo=__HERE__;
}
struct foobar{
   int i;
   float f;
   alias fizz=foo!();//i,f
   bool b;
}
```


More information about the dip.ideas mailing list