Re: Why does partial ordering of overloaded functions not take return type into account?

2016-02-20 Thread cym13 via Digitalmars-d-learn
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

Re: Why does partial ordering of overloaded functions not take return type into account?

2016-02-20 Thread Mike Parker via Digitalmars-d-learn
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

Re: Why does partial ordering of overloaded functions not take return type into account?

2016-02-20 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 20 February 2016 at 15:47:27 UTC, Jeremy DeHaan wrote: With the case of auto of course there is ambiguity, you don't know which one to pick. In my example there should have been no ambiguity at all as only one of the overloads would actually compile. That is what confuses me and

Re: Why does partial ordering of overloaded functions not take return type into account?

2016-02-20 Thread Chris Wright via Digitalmars-d-learn
On Sat, 20 Feb 2016 15:47:27 +, Jeremy DeHaan wrote: > If there are multiple overloads that have the same number of parameters, > a very simple addition to the rules of function overloading would be > "does it compile?" If only one overload compiles, use it. If more than > one compile, there

Re: Why does partial ordering of overloaded functions not take return type into account?

2016-02-20 Thread Jeremy DeHaan via Digitalmars-d-learn
On Saturday, 20 February 2016 at 12:29:21 UTC, Jonathan M Davis wrote: On Saturday, February 20, 2016 03:24:45 Jeremy DeHaan via Digitalmars-d-learn wrote: snip I'm unaware of any language that takes the return type into account when overloading. The type the expression test.thing() has to

Re: Why does partial ordering of overloaded functions not take return type into account?

2016-02-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, February 20, 2016 03:24:45 Jeremy DeHaan via Digitalmars-d-learn wrote: > module main; > > struct ThingOne > { > int thing = 1; > } > > struct ThingTwo > { > float thing = 2; > } > > > struct Test > { >ThingOne thing() > { >return ThingOne(); > } > >

Why does partial ordering of overloaded functions not take return type into account?

2016-02-19 Thread Jeremy DeHaan via Digitalmars-d-learn
module main; struct ThingOne { int thing = 1; } struct ThingTwo { float thing = 2; } struct Test { ThingOne thing() { return ThingOne(); } ThingTwo thing() { return ThingTwo(); } }