What to do about default function arguments

Walter Bright newshound2 at digitalmars.com
Wed Apr 25 22:08:26 PDT 2012


On 4/25/2012 9:42 PM, H. S. Teoh wrote:
> This is bad. What if you have two delegates with different default
> arguments? What would this code do:
>
> 	auto foo = (int a=1) { return a; };
> 	auto bar = (int a=2) { return a; };
> 	writeln(foo());
> 	writeln(bar());
>
> ?

Give you two error messages, because default arguments wouldn't be allowed for 
delegates.


More information about the Digitalmars-d mailing list