does alias this work correctly?

Zhenya zheny at list.ru
Mon Jan 14 06:28:17 PST 2013


On Sunday, 13 January 2013 at 23:21:20 UTC, Andrey wrote:
>> I just want very much avoid renaming function,it's principle 
>> for me.
>> So I would like to know is my sample right or no.
>
> I think that the main overall principle here is that is it 
> impossible to have two functions which differ only by static 
> attribute. I even do not imagine the use case of this.
>
> Well, here is the most natural way to achieve similar effect, I 
> suppose:
>
> struct MyStruct {
>
> 	struct Static {
>
> 		static void myfun() {
> 			writeln("static myfun");
> 		}
> 	}
>
> 	void myfun() {
> 		writeln("myfun");
> 	}
>
> 	static Static opCall() {
> 		return Static();
> 	}
> }
>
>
> MyStruct obj;
>
> obj.myfun(); //dynamic;
> MyStruct().myfun(); //static;
I do not agree with you, static attribute is not a small detail.
this reference is the same argument, like all the others. And 
despite the fact that
function signatures are the same, the actual list of arguments 
are different.


More information about the Digitalmars-d-learn mailing list