Apparently unsigned types really are necessary

Era Scarecrow rtcvb32 at yahoo.com
Sun Jan 22 13:24:56 PST 2012


> 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.


More information about the Digitalmars-d mailing list