Allow empty field function arguments for default?

Jacob Carlborg doob at me.com
Mon Apr 23 04:40:58 PDT 2012


On 2012-04-23 10:05, Christophe wrote:

> Hum, an acceptable solution would be to give an error, asking to
> explicitely asking to fully qualify the name :
>
> void fun(int c = 0) {...}
>
> void main()
> {
>    int c;
>    fun(c=5); // error, ambiguous qualifier "c"
>    fun(main.c = 5); // ok
>    fun((c=5)); // ok
>    fun(fun.c = 5); // ok, but different meaning.
> }
>
> But still, raising an arror is not backward compatible.

Would the following syntax be backwards compatible:

foo(c: 0)

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list