Should we deprecate comma?
Etienne Cimon
etcimon at gmail.com
Sun Mar 23 21:29:16 PDT 2014
On 2014-03-24 00:04, Andrei Alexandrescu wrote:
> On 3/23/14, 8:22 PM, Etienne Cimon wrote:
>> How about allowing it only inside parenthesis?
>
> That works but breaks more valid code. -- Andrei
>
If the comma expression operator is outlawed on the global scope,
variadic template parameters could be used with commas outside the
parantheses which allows such syntax:
if(pMgr->ShouldRecordEvent(eSE_Weapon), pOwnerRaw) // ERROR
return pMgr->RecordEvent(eSE_Weapon), pOwnerRaw; // ERROR
if(e!pMgr->ShouldRecordEvent(eSE_Weapon), pOwnerRaw) // OK
return e!pMgr->RecordEvent(eSE_Weapon), pOwnerRaw; // OK
Would it make sense to reserve the global e identifier for expressions?
I'd be happy to see commas go and eventually wake up to this in a few
years, also enabling what would seem like a new kind of comma operator
overloading
More information about the Digitalmars-d
mailing list