Re: Reducing visual clutter.

2017-01-01 Thread Nicholas Wilson via Digitalmars-d-learn
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:

[...]


Oh and `kernel` could be a template function that would need 
its args forwarded to it.


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.





Re: Reducing visual clutter.

2016-12-31 Thread Ignacious via Digitalmars-d-learn
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:

[...]


Oh and `kernel` could be a template function that would need 
its args forwarded to it.


Alias it away using a wrapper?


Re: Reducing visual clutter.

2016-12-31 Thread Nicholas Wilson via Digitalmars-d-learn
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.


Reducing visual clutter.

2016-12-31 Thread Nicholas Wilson via Digitalmars-d-learn

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?