On 06/22/2018 09:27 PM, aedt wrote:
for line in stdin.lines() {}if condition {} while condition {} for init; condition; op {}What's the rationale of keeping the requirement that the condition of if/for/while must be wrapped with a parenthesis (other than keeping parser simple)? Modern languages have already dropped this requirement (i.e. Rust, Nim) and I don't see any reason not to do so.
Mainly because of D's C-family lineage. D was designed to use syntax that would be familiar to programmers of the other popular C-derived languages of the time (mainly: C, C++, Java, C#). Making parens optional in a C-ish (more or less) language was largely popularized by Go, but at the time, Go didn't exist yet.
Whatever the reasons, I'm personally glad it worked out this way: I find it very difficult to visually parse loops and conditionals that omit the parens. Without them, there just isn't enough visual "landmarks" for my brain's visual center to lock-on and pattern-recognize a standard loop or conditional.
