www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - getOverloads, but also include all the imported members

reply Yuxuan Shui <yshuiv7 gmail.com> writes:
Say:

module one;
void func(int a){}

/////////////////////

module two;
import one;
void func(float a){}

Is there a way to get both func() in module two?
Mar 23 2016
parent reply Marc =?UTF-8?B?U2Now7x0eg==?= <schuetzm gmx.net> writes:
On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote:
 Say:

 module one;
 void func(int a){}

 /////////////////////

 module two;
 import one;
 void func(float a){}

 Is there a way to get both func() in module two?
Add in module two: alias func = one.func;
Mar 24 2016
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 24 March 2016 at 12:11:33 UTC, Marc Schütz wrote:
 On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote:
 module one;
 void func(int a){}
 /////////////////////
 module two;
 import one;
 void func(float a){}
Add in module two: alias func = one.func;
Indeed, the two funcs are NOT overloaded right now unless you add that alias. See : http://dlang.org/hijack.html for details.
Mar 24 2016
parent reply Yuxuan Shui <yshuiv7 gmail.com> writes:
On Thursday, 24 March 2016 at 13:55:31 UTC, Adam D. Ruppe wrote:
 On Thursday, 24 March 2016 at 12:11:33 UTC, Marc Schütz wrote:
 On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote:
 module one;
 void func(int a){}
 /////////////////////
 module two;
 import one;
 void func(float a){}
Add in module two: alias func = one.func;
Indeed, the two funcs are NOT overloaded right now unless you add that alias. See : http://dlang.org/hijack.html for details.
Is there a way to do this automatically?
Mar 24 2016
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 24 March 2016 at 15:07:09 UTC, Yuxuan Shui wrote:
 Is there a way to do this automatically?
No. You have to decide to bring them together if you want them to overload.
Mar 24 2016
parent Yuxuan Shui <yshuiv7 gmail.com> writes:
On Thursday, 24 March 2016 at 15:52:49 UTC, Adam D. Ruppe wrote:
 On Thursday, 24 March 2016 at 15:07:09 UTC, Yuxuan Shui wrote:
 Is there a way to do this automatically?
No. You have to decide to bring them together if you want them to overload.
Oh, sorry, this is not what I meant. What I wanted to know is if it's possible to automate this aliasing process, by using for example templates?
Mar 25 2016