[Issue 6579] Calling static method should *require* using type and not instance, unless specified by author

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 3 07:52:19 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6579



--- Comment #7 from art.08.09 at gmail.com 2012-06-03 07:54:14 PDT ---
(In reply to comment #6)
> Slightly refining the overloading rules as proposed in issue 3345 would already
> solve the problem.

> struct T{
>     static void foo(){...}
>     void bar(){...}
> }

>     t.foo(); // ok

This seems too dangerous to allow (by default).

Do static and non-static methods form one overload set?

struct S {
 static auto opCall(int) {...}
 auto opCall(string) {...}
}

Oh, and i just noticed the suggestion in this report that static fields should
not be accessible via an instance - no, that would a break a lot of code, for
almost no gain (you can already place the static data in another struct and
embed
that one in an (anonymous) union)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list