How To: Passing curried functions around
Bahman Movaqar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Sep 7 02:17:42 PDT 2015
On Monday, 7 September 2015 at 03:55:01 UTC, Meta wrote:
> The name validator_t is not idiomatic in D. Something like
> ValidatorFun should be preferred. Same for intReader_t;
> ReadIntFun is probably preferred, or even IntReader (but that
> would imply that it's a struct/class in my mind).
Noted. Thanks.
> As for the actual use of partial, it's perfectly fine and
> idiomatic to use.
Good. Now the questions is what should be the signature of the
receiving functions if I'm going to pass the (double) curried
function around?
For example, considering the original piece of code, if I do
alias partial!(partial!(readInt, "Enter an integer:"),
&isEven) ReaderFun;
is the following a valid signature for `foo`, to which I'll pass
a `ReaderFun`?
void foo((int delegate() readerFun)
More information about the Digitalmars-d-learn
mailing list