Why does partial ordering of overloaded functions not take return type into account?
cym13 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 20 10:59:56 PST 2016
On Saturday, 20 February 2016 at 17:22:49 UTC, Mike Parker wrote:
> On Saturday, 20 February 2016 at 17:20:16 UTC, Mike Parker
> wrote:
>
>> getValue();
>>
>> It's not unusual to discard the return value when calling a
>> function. Though a getter isn't a good example of this, of
>> course.
>
> Oops. I somehow had it in my head that your example function
> was getValue(), rather than thing(). Anyway, my point was that
> the return value is not always used when calling a function
> with side effects.
There's also the nice case:
void foo(string s) {
...
}
void foo(int i) {
...
}
string bar() {
...
}
int bar() {
...
}
void main() {
foo(bar); // Which one is it supposed to be?
}
More information about the Digitalmars-d-learn
mailing list