Allow empty field function arguments for default?

Jakob Ovrum jakobovrum at gmail.com
Fri Apr 20 04:42:53 PDT 2012


On Friday, 20 April 2012 at 11:09:30 UTC, Jacob Carlborg wrote:
> On 2012-04-20 11:17, Christophe wrote:
>> "Jakob Ovrum" , dans le message (digitalmars.D.learn:34948), a 
>> écrit :
>>> On Thursday, 19 April 2012 at 18:34:41 UTC, Jacob Carlborg 
>>> wrote:
>>>>
>>>> Named arguments would probably be better for this.
>>>>
>>>> fun(c = 5);
>>>
>>> Maybe so, but `fun(c = 5);` is not an additive change, while 
>>> the
>>> OP's suggestion actually is.
>>
>> How about
>>
>> int c;
>> fun(c = 5);
>>
>> ?
>>
>
> I don't know. Default arguments would probably take precedence 
> perhaps.

That is exactly the problem though, it can silently change the 
behaviour of existing code. It is the worst kind of breaking 
change, hence I don't think it will ever be in D in this form, 
much less the current iteration of the language.


More information about the Digitalmars-d-learn mailing list