Optional parameters?

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 2 12:53:53 UTC 2018


On 4/1/18 12:00 PM, Jacob Carlborg wrote:

> 
> Yeah, D doesn't allow user defined implicit conversions, which I think 
> is required for this. I would make function overloading even more 
> complex than it is today.
> 
> Although it would be really handy for cases like this.
> 

Not necessarily implicit conversion, but implicit construction.

The nicety with D's overloading rules are they are simple -- if there is 
an exact match, use it. If there is a conversion possible, use it. If 
multiple conversions are possible, ambiguity error.

Adding another way to convert doesn't seem like it would cause lot's of 
complication or harm.

-Steve


More information about the Digitalmars-d-learn mailing list