On Friday, 24 July 2015 at 21:11:20 UTC, Walter Bright wrote:
On 7/24/2015 1:11 PM, Jonathan M Davis wrote:
On Friday, 24 July 2015 at 19:59:17 UTC, Shammah Chancellor
wrote:
Funny, they work beautifully in C#.
https://msdn.microsoft.com/en-us/library/dd264739.aspx
Well, I don't know how C# dealt with mixing function
overloading with named
arguments (I haven't read the article yet)
Here's what it says:
-----------------
Use of named and optional arguments affects overload resolution
in the following ways:
•A method, indexer, or constructor is a candidate for execution
if each of its parameters either is optional or corresponds, by
name or by position, to a single argument in the calling
statement, and that argument can be converted to the type of
the parameter.
•If more than one candidate is found, overload resolution rules
for preferred conversions are applied to the arguments that are
explicitly specified. Omitted arguments for optional parameters
are ignored.
•If two candidates are judged to be equally good, preference
goes to a candidate that does not have optional parameters for
which arguments were omitted in the call. This is a consequence
of a general preference in overload resolution for candidates
that have fewer parameters.
--------------------
D already has plenty enough overloading rules, UFCS,
overloading templates with non-templates, default values,
constraints, overriding, covariance/contravariance, auto ref,
etc., enough to thoroughly confuse everyone already :-)
Yeah. That sounds pretty ugly. And in D, we already tend to lean
towards giving an error rather than picking a better option over
a worse one in order to minimize problems related to overloading.
We don't need that mess to be even more complicated - especially
just for syntactic sugar (though I confess, that I do think that
it's syntactic salt, so I'm obviously a bit biased against it
anyway).
- Jonathan M Davis