On 01/22/2012 01:24 PM, Era Scarecrow wrote:
My I propose the following modifications to the D lexer:

'''
White space may consist of:
- A comment between any two tokens.
- A single space between tokens that, if adjoined would be a
single token.

All other white space (including \n \r \t \v, etc.) is
forbidden and a lexical error.
'''

With these additions, all valid D code will be so hard to read that
nobody will ever attempt to read it without first running a re-formatter
over it and once that is standard practice, everyone will see it in
there own preferred style.

'\n' would be a invalid white space? Wow I see problems with that. Take a 
following debugging function of mine. Uses combination spaces, newlines and 
tabs. I think it's easy to read and understand.

//(incomplete without the full class/struct, but you get the idea)
void print() {
        writeln("\nP.empty = ", empty,
                "\nP.front = ", front,
                "\nP.position = ", position,
                "\nP.cap = ", cap,
                "\nP.map = ", map, "\n");
}


That would instead becomes

void print() {
     writeln("\nP.empty = ", empty, "\nP.front = ", front, "\nP.position = ", position, "\nP.cap = 
", cap, "\nP.map = ", map, "\n");        
}

   Far more likely the rules would have to be set for the editor to convert 
tabs into specific number of spaces and save it as such (and convert them back 
if they want). Otherwise in said projects, enforce certain rules for the 
project regarding formatting and reject it otherwise until they fix it.

Points:
1) that 2nd formatting still includes whitesapce that would be illegal (e.g. every place but between 'void' and 'print' and in the strings litereals).
2) The *point* is to turn code into an unreadable mash on a single line.
3) The entire proposal is satire.

Reply via email to