Dream Feature Regarding Default Arguments

Frustrated Who at where.com
Sun Apr 6 16:08:09 PDT 2014


On Sunday, 6 April 2014 at 21:06:44 UTC, Nick Sabalausky wrote:
> On 4/6/2014 10:47 AM, JN wrote:
>>
>> Wouldn't it be better to have named parameters like in Python 
>> or
>> C#? That way you could call the function like:
>>
>> func(foo=myFoo) or func(bar=myBar) or func(foo=myFoo, 
>> bar=myBar)
>> and there would be no ambiguity.
>
> Named parameters would be a good compliment to this (and I have 
> always wanted named parameters in D), but even with them it 
> would still be nice to be able have neat-n-tidy implementations 
> of func([foo],[bar]) APIs that don't require the use of named 
> params.

How bout

func(,,x,,y)

or

func(default, default, x, default, default, y)?

where default is a keyword that substitutes the default value.



More information about the Digitalmars-d mailing list