Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

syntactic triviality



This is completely unimportant, but if anyone is interested:

    while true && true; do echo true; done

I'm wondering if, strictly speaking, the 'do' needs to be necessary. I'm guessing that it's necessary by fiat simply because it visually pairs nicely with 'done', which certainly must be there to end a block of commands. I'm thinking that the semi after 'true' ends the condition tests part of the loop, and begins the execution part, thusly, after the semi, the 'do' tells the parser nothing that it does not already know, thusly it might have been possible to design the syntax without the 'do'. (Not that I'm suggesting that, I'm just curious.) IOW, is there some situation where the parser might actually be confused after the first semi, and before the 'do', such that the 'do' adds necessary control?

Same thing with the 'then' in 'if' tests.



Messages sorted by: Reverse Date, Date, Thread, Author