DIP19: Remove comma operator from D and provision better syntactic support for tuples

jerro a at a.com
Sun Sep 23 15:30:27 PDT 2012


On Sunday, 23 September 2012 at 21:37:06 UTC, Adam D. Ruppe wrote:
> I'm not for removing the comma operator, but it occurs to me we 
> could do it in the library:
>
> auto commaOperatorReplacement(T...)(T t) {
>    return t[$-1];
> }
>
> There might be some edge case where that wouldn't work, but I 
> think it works in most cases.

If D is like C in this regard, then the function above cannot 
replace comma operator, because the order of evaluation is 
defined for comma operator, but not for function parameters. You 
could use something like that, though:


More information about the Digitalmars-d mailing list