Alvin Bruney said:
Isn't there ambiguity in overloading as it stands today?
public Int32 BlahFn(Control c)
public Int32 BlahFn(Button b)
If it can resolve that, then it can do the same with return type
overloading.
It can, its not perfect however. In the case of parameters the user HAS to
specify the parameter, as the language stands today return types can be
ignored.
Other languages can manage it, so I am sure C# can also if they banged
theyre developers heads off the wall a few times.
I'm sure they could, but would it be a good thing? At the very least call
syntax would have to exist to provide explicit overload calling instead of
implicit guessing(Ideally the compiler would require return type
specification instead of forcing accepting the return in clashing cases). It
is also not a feature in the CLS and would probably require you to provide
less natural second methods to support VB and C++, for example.
There are other things I'd consider more important to implement, however,
like Eiffels Design by Contract or a more powerful component contracting
mechanism(which would specify the contract rules within itself, ideally).
More importantly, what does the rest of the community think? Out of everyone
who's posted here, only the two of us have mentioned that yes, return tyupe
overloading would be useful. I'm only aganst it as a purely implicit thing,
as an explicit specification it could be acceptable.