On Tuesday, 15 January 2013 at 22:03:24 UTC, Era Scarecrow wrote:
On Sunday, 13 January 2013 at 16:39:22 UTC, bearophile wrote:
Maxim Fomin:
dmd allows to call static functions on instance.
I think that's a D design mistake (and I think Jonathan Davis
agrees with me), but Walter prefers the current behavour.
I'll have to disagree and it should remain an error.
Consider his example, if it were allowed and you do:
Gun gun;
Gun.bar();
gun.bar();
The problem is that code depends on presence of static and
no-static functions. If no one is preferred, compiler would issue
error (like dmd behaves today), if one of them is preferred (for
e.x. non-static) the semantic would be silently changed if you
write gun.bar() and then add non-static function to class.