function default arguments depending on other arguments

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 18 10:40:22 PDT 2014


On 07/18/2014 12:00 AM, Trass3r wrote:
> void foo(int a, int b = a)
> {
> }
> is illegal in C++ because order of evaluation is undefined.
>
> But since D defines the order to be left to right couldn't it also allow
> this?

It could, and I think it is an unnecessary limitation that it currently 
does not. (This can also be useful if that parameter is the hidden 
'this' reference.)


More information about the Digitalmars-d mailing list