Re: Get return type statically

2016-06-29 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jun 27, 2016 at 08:13:21PM -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, Jun 28, 2016 at 01:41:03AM +, Smoke Adams via Digitalmars-d-learn > wrote: > > I have a type > > > > public class SuperFunction(T) > > { > > T t; > > return(T) Do() { return t(); } > > } > > >

Re: Get return type statically

2016-06-27 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 28, 2016 at 01:41:03AM +, Smoke Adams via Digitalmars-d-learn wrote: > I have a type > > public class SuperFunction(T) > { > T t; > return(T) Do() { return t(); } > } > > where T is a delegate or function. First, I would like to be able to > specify that this must be the

Re: Get return type statically

2016-06-27 Thread Ali Çehreli via Digitalmars-d-learn
On 06/27/2016 06:41 PM, Smoke Adams wrote: I have a type public class SuperFunction(T) { T t; return(T) Do() { return t(); } } where T is a delegate or function. First, I would like to be able to specify that this must be the case for SuperFunction so we can't pass non-function/delegates

Re: Get return type statically

2016-06-27 Thread Smoke Adams via Digitalmars-d-learn
I should point out also that this should be inheritable. Eventually I would like to create an algebra of SuperFunctions. e.g., SF3 = SF1 + SF2 is a new super function that combines the parameter list of SF1 and SF2 and unionizes their return type. Both functions are called by Do(which will

Re: Get return type statically

2016-06-27 Thread Smoke Adams via Digitalmars-d-learn
On Tuesday, 28 June 2016 at 01:41:03 UTC, "Smoke" Adams wrote: I have a type public class SuperFunction(T) { T t; return(T) Do() { return t(); } } where T is a delegate or function. First, I would like to be able to specify that this must be the case for SuperFunction so we can't pass

Get return type statically

2016-06-27 Thread Smoke Adams via Digitalmars-d-learn
I have a type public class SuperFunction(T) { T t; return(T) Do() { return t(); } } where T is a delegate or function. First, I would like to be able to specify that this must be the case for SuperFunction so we can't pass non-function/delegates for T. Second, How to specify the return