Consider this example:
struct A
{
static void foo () {}
void foo () {}
}
void main ()
{
A a;
A.foo(); // error here
a.foo(); // and same here
}
Error: function main.A.foo called with argument types:
(())
matches both:
main.A.foo()
and:
main.A.foo()
Which is ok for "a.foo()" case, because it is possible to call static and
instance functions on instance variable. But I would expect to be possible
to call A.foo() because there is no ambiguity.
Can somebody please explain me rationale behind this. Can this possibly prevent
some errors? Because now it seems to me like unnecessary restriction.
If this has reason, why then not issue error sooner - when declaring static/instance
overloaded functions.