OT: for (;;) {} vs while (true) {}

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 1 13:49:42 PST 2016


On Thursday, December 01, 2016 19:25:27 Meta via Digitalmars-d wrote:
> On Friday, 25 November 2016 at 15:29:31 UTC, Adam D. Ruppe wrote:
> > On Friday, 25 November 2016 at 15:03:26 UTC, Andrei
> >
> > Alexandrescu wrote:
> >> We need to change the range API then. -- Andrei
> >
> > That's absurd, popFront is in no way semantically a property,
> > so it should not get @property.
> >
> > It has been so many years of this being poorly defined. Let's
> > just close the book and officially put the status quo on
> > optional parenthesis in stone: they are optional on
> > zero-argument calls, regardless of @property, and that isn't
> > going to change.
> >
> > Then this popFront question becomes moot.
>
> This causes a world of pain when you want to pass functions
> around. Nothing gets my blood pressure up like the following code:
>
> https://forum.dlang.org/post/piktfrtpltmjvjmedspr@forum.dlang.org

I think that having optional parens in D was a mistake, and your situation
there is an example of why it can be a big problem (the problems caused by
being lax with syntax in generic code is another). However, the shipped has
long since sailed on that one. It's too popular and too widely used to
change at this point. And while I completely agree that allowing optional
parens causes problems, it's also true that a lot of code is able to use it
without difficulties, and many folks like it, particularly when they have to
use parens for template arguments in UFCS call chains.

- Jonathan M Davis



More information about the Digitalmars-d mailing list