On Saturday, 23 June 2018 at 08:07:23 UTC, Jacob Carlborg wrote:
On 2018-06-23 03:27, 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.
For the parentheses to be optional I think the curly brace need
to be mandatory, or perhaps force a newline after the
condition. I don't see how this would be any better. You're
trading one set of required punctuational characters for
another set. This would also take D one step further away from
the C family of languages.
I wouldn't like the new line constraint. Forcing Curly braces is
nice, logic and natural imo.