Killing the comma operator

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Wed May 11 15:32:51 PDT 2016


On Wednesday, 11 May 2016 at 18:36:11 UTC, H. S. Teoh wrote:
> On Wed, May 11, 2016 at 05:55:27PM +0000, deadalnix via 
> Digitalmars-d wrote:
>> On Wednesday, 11 May 2016 at 16:44:43 UTC, H. S. Teoh wrote:
>> >That's what I've been saying, it should be treated as a 
>> >special case in the syntax of for-loops, but not as an 
>> >operator in general.
>> >
>> 
>> Please no special cases.
>
> You misunderstand, what I mean is that the comma should be 
> *part of* for-loop syntax, instead of being part of expression 
> syntax. I.e., for-loop grammar should read something like this:
>
> for-loop:
> 	"for" "(" loop-init ";" loop-condition ";" loop-increment ")" 
> block
>
> loop-init:
> 	comma-separated-exprs
>
> loop-condition:
> 	comma-separated-exprs
>
> loop-increment:
> 	comma-separated-exprs
>
> comma-separated-exprs:
> 	expression
> 	expression "," comma-separated-exprs
>
> And the grammar for expression should have zero references to 
> comma operators.
>
>
> T

loopinit is a statement, but I see the idea. Works for me.



More information about the Digitalmars-d mailing list