Killing the comma operator

Lionello Lunesu via Digitalmars-d digitalmars-d at puremagic.com
Wed May 11 19:51:33 PDT 2016


On 11/5/2016 21:13, deadalnix wrote:
> On Wednesday, 11 May 2016 at 10:50:47 UTC, Lionello Lunesu wrote:
>> On 10/5/2016 22:16, deadalnix wrote:
>>> On Tuesday, 10 May 2016 at 10:09:40 UTC, Andrei Alexandrescu wrote:
>>>> On 5/10/16 12:52 PM, Mathias Lang wrote:
>>>>> So, following DConf2016, I raised a P.R. to deprecate usage of the
>>>>> comma
>>>>> expressions, except within `for` loops increment [5].
>>>>
>>>> The agreed-upon ideea was to allow uses that don't use the result
>>>> (including for loops). No? -- Andrei
>>>
>>> Let's just make it of void type, there was plan to recycle the syntax
>>> maybe, but whatever we do in the future, this is the sensible first
>>> step.
>>
>> Acutally, we can do two-birds-one-stone: instead of making it void,
>> make it a value tuple!
>>
>
> No. You can't change semantic to something that'll still work under the
> feet of the user. If this syntax is to be recycled to tuple, the value
> needs to be void for a while as to shake out uses.
>
> It is safe to go from void to something else, it isn't not to go from
> something to something else.
>

I agree with you when the 1st something and 2nd something are somehow 
compatible. void is also a something, but it'd work because it'd never 
silently change the meaning of code.

I'm trying to think of a case where changing a single value into a tuple 
with 2 (or more) values would silently change the behavior, but I can't 
think of any. Seems to me it would always cause an error, iff the result 
of the comma operator gets used.


More information about the Digitalmars-d mailing list