Static method conflicts with non-static method?
so
so at so.so
Fri Apr 27 05:11:48 PDT 2012
On Friday, 27 April 2012 at 11:51:40 UTC, Steven Schveighoffer
wrote:
> The idea I came up with in my proposal
> (http://d.puremagic.com/issues/show_bug.cgi?id=6579) was to
> allow aliasing the static method into the instance namespace:
>
> struct S1
> {
> static void foo() {}
> alias S1.foo this.foo;
> }
>
> struct S2
> {
> static void foo() {}
> }
>
> void main()
> {
> S1 i1;
> S2 i2;
> S1.foo(); // ok
> i1.foo(); // ok
> S2.foo(); // ok
> i2.foo(); // error
> }
>
> -Steve
But call site remains unchanged, which was the main reason of
confusion. If we expect user to read the function declaration
anyway, an extra alias won't do much good or probably complicate
it even further.
More information about the Digitalmars-d
mailing list