Comma operator = broken design

Don nospam at nospam.com
Thu Dec 8 02:35:19 PST 2011


On 08.12.2011 05:52, bcs wrote:
> On 12/07/2011 08:49 AM, Alex Rønne Petersen wrote:
>> I really do not see the value in allowing such syntax in the first
>> place. I've been told that one argument was that generated code might
>> use it, but I have no idea why it would be needed. Furthermore, this
>> operator makes it very hard to introduce Python-style tuples in the
>> language.
>
> IIRC the generated code argument was actually made with regards to the
> compiler doing internal rewriting of the AST. If I'm remembering
> correctly, this make it even weaker as, at that point, there is no
> reason that the form of the AST need match the syntax.

Worth noting that the comma operator inside the compiler is not the same 
as the one in the language. It supports declarations, in a way that D 
doesn't. You can't write this in normal D, for example:

    (int x; , x = 2);

But that's what the compiler does internally.

The "compiler uses it internally" argument isn't valid at all.


More information about the Digitalmars-d mailing list