function argument accepting function or delegate?

2016-01-16 Thread Jon D via Digitalmars-d-learn
My underlying question is how to compose functions taking functions as arguments, while allowing the caller the flexibility to pass either a function or delegate. Simply declaring an argument as either a function or delegate seems to prohibit the other. Overloading works. Are there better way

Re: function argument accepting function or delegate?

2016-01-16 Thread rsw0x via Digitalmars-d-learn
On Sunday, 17 January 2016 at 06:27:41 UTC, Jon D wrote: My underlying question is how to compose functions taking functions as arguments, while allowing the caller the flexibility to pass either a function or delegate. [...] Templates are an easy way. --- auto call(F, Args...)(F fun, auto

Re: function argument accepting function or delegate?

2016-01-16 Thread Jon D via Digitalmars-d-learn
On Sunday, 17 January 2016 at 06:49:23 UTC, rsw0x wrote: On Sunday, 17 January 2016 at 06:27:41 UTC, Jon D wrote: My underlying question is how to compose functions taking functions as arguments, while allowing the caller the flexibility to pass either a function or delegate. [...] Template

Re: function argument accepting function or delegate?

2016-01-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/17/16 1:27 AM, Jon D wrote: My underlying question is how to compose functions taking functions as arguments, while allowing the caller the flexibility to pass either a function or delegate. Simply declaring an argument as either a function or delegate seems to prohibit the other. Overloadi