Generally speaking, a language design may be consistent but that doesn't make it necessarily good design. However, in this case I didn't say that the while statement outside of the respective code block is a design flaw but rather a bad choice. IMO, if you have statements inside the block that similarly influence the loop, such as break or continue, then why put others outside of it?caseih wrote:But this is the first time I've heard the claim that one of the most consistent features of C's grammar is a design flaw!
I think that it was a logical continuation of ALGOL related languages.The fact that a <statement> production in the C grammar can be either a single statement or a block of statements was really neat thinking on K&R's part. It simplified the grammar a lot and reduces ambiguities. That's what I consider good design.
This is true and it also applies to Pascal and other languages that were developed at the time. In fact, Pascal became hugely popular when it became the first language delivering an all-in-one compiler that parsed and compiled source code in one go on computers that - at the time - were still limited. It was only later on that C became more popular, largely thanks to UNIX.K&R's decisions were also based on the realities of computers at the time. Grammars like FB has today would have made the compiler impossibly slow and memory-intensive back then. They struck an amazing balance between the needs of the programmer and the limited power of the compiler that still serve us well today. Obviously today we have more freedom to design things differently when starting over. So whatever works for Sharp BASIC, good on you.
There have been innumerable attempts of programming language design in the last 50 years, many of which have tried to improve the syntax and paradigms of existing languages. Although I don't particularly like the begin..end implementation of Pascal, I still consider it better than curly braces, which IMO make code difficult to read and I try to avoid those languages as much as possible. But this is probably just as endless a debate as OOP vs non-OOP.
In any case, I think that any attempt of improving syntax with a new language should be encouraged and not seen as criticism or an attack on existing languages.