digitalmars.D.learn - Reducing visual clutter.
- Nicholas Wilson (33/33) Dec 31 2016 so I have
- Nicholas Wilson (4/5) Dec 31 2016 Oh and `kernel` could be a template function that would need its
- Ignacious (3/8) Dec 31 2016 Alias it away using a wrapper?
- Nicholas Wilson (7/12) Jan 01 2017 It's worse than that `kernel` could be a qualified name which
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?
Dec 31 2016
On Saturday, 31 December 2016 at 11:39:39 UTC, Nicholas Wilson wrote:[...]Oh and `kernel` could be a template function that would need its args forwarded to it.
Dec 31 2016
On Saturday, 31 December 2016 at 12:31:07 UTC, Nicholas Wilson wrote:On Saturday, 31 December 2016 at 11:39:39 UTC, Nicholas Wilson wrote:Alias it away using a wrapper?[...]Oh and `kernel` could be a template function that would need its args forwarded to it.
Dec 31 2016
On Saturday, 31 December 2016 at 12:31:07 UTC, Nicholas Wilson wrote:On Saturday, 31 December 2016 at 11:39:39 UTC, Nicholas Wilson wrote:It's worse than that `kernel` could be a qualified name which would require the opDispatch shenanigans to attempt to recreate piece-by-piece the QN with successive opDispatch's. Urgh. As much as I don't want to, C++ style opBinary!"<<" is looking the cleanest.[...]Oh and `kernel` could be a template function that would need its args forwarded to it.
Jan 01 2017









Ignacious <I.D.T ProjectMaya.com> 