Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
March 23, 2016 getOverloads, but also include all the imported members | ||||
---|---|---|---|---|
| ||||
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? |
March 24, 2016 Re: getOverloads, but also include all the imported members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | 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;
|
March 24, 2016 Re: getOverloads, but also include all the imported members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | 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. |
March 24, 2016 Re: getOverloads, but also include all the imported members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | 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?
|
March 24, 2016 Re: getOverloads, but also include all the imported members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | 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.
|
March 25, 2016 Re: getOverloads, but also include all the imported members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | 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?
|
Copyright © 1999-2021 by the D Language Foundation