Reducing visual clutter.
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Dec 31 03:39:39 PST 2016
so I have
```
struct Pipeline
{
// some fields.
ref typeof(this) invoke(alias kernel)(TransformArgsOf!kernel
args)
{
//...
return this;
}
}
```
and it will be used like
```
void fun1(int a) {}
void fun2(double b) {}
void funn(ulong c) {}
//...
auto pipe = Pipeline(...);
pipe.invoke!fun1(42)
.invoke!fun2(3.14)
.invoke!funn(1u)
//...
;
```
is there anyway to reduce the visual noise of the `invoke`?
I was thinking of trying to (ab)use opDispatch + mixins that
returns a callable whose opCall returns the Pipeline by ref. I'm
not sure how well that would go given I need `kernel.mangleof`,
`typeof(kernel)` and `Parameters!kernel`.
Is there a nicer way to achieve this? Or is this shenanigans not
worth it?
More information about the Digitalmars-d-learn
mailing list