Can call static method with null reference
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jun 23 03:04:05 PDT 2013
On Sunday, June 23, 2013 11:30:11 Jacob Carlborg wrote:
> On 2013-06-22 23:51, Timon Gehr wrote:
> > If that is the only problem then the solution is to allow overloading on
> > static, which is easy to do.
>
> You still need to call the static method on the class/struct if there's
> an ambiguity.
I would have thought that that was obvious, and I fail to see why that would
be a problem. The only risk I see in allowing static and non-static functions
to be overloaded, is that if you have static function being called with an
instance, and you add a non-static overload, then the code would silently
change to call the non-static function. But we have that exact same problem
with UFCS and member functions as it is, and that wouldn't break any existing
code (since you can't overload on static right now). It would just be a future
risk of breaking code.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list