On Sunday, June 24, 2018 22:03:13 Dennis via Digitalmars-d wrote:
> On Saturday, 23 June 2018 at 02:14:04 UTC, Jonathan M Davis wrote:
> > In general, C code is supposed to be either valid D code or not
> > compile in order to making porting it easier. Getting rid of
> > the parens wouldn't break that, but it _would_ make it so that
> > it's more work to port C code to D when doing so is supposed to
> > be straightforward in most cases.
> >
> > And of course, the counter question to why the parens shouldn't
> > be removed would be the question of why they should be. What
> > about having parens makes the code worse? Many of us would
> > consider the code easier to read with parens.
>
> I don't see why allowing one to omit the parens makes porting C
> code harder.

It makes it harder if the language does not have parens on if statements,
while loops, etc., because then you have to remove them from all of the code
that you're porting. Having them be optional shouldn't make porting harder.
The OP's post said nothing about making them optional, just complained that
they were in the language, so I posted based on the assumption that they
were arguing for their removal from the language. However, optional parens
would make it more confusing when reading code (since then you have to
figure out whether parens go with the if or the expression in the
conditional), and it's the sort of thing that's just going to start style
wars.

Also, usually, I hear about how folks _like_ D's syntax and find it easy to
learn, whereas many complain about the syntax in languages such as Rust
(it's my understanding that folks tend to like Rust in spite of its syntax,
not because of it). So, it seems a bit odd to try and emulate them.

Regardless, personally, I don't want to have to deal with reading code that
omits parens on if statements and loops. It just makes the language less
consistent and makes it more work to read code (as well as opening the door
for yet more arguments about the style guidelines on projects). Obviously,
others can disagree, but I'd vote strongly against any attempt to change D
in this regard.

- Jonathan M Davis

Reply via email to