A suggestion on keyword for_each
Jonathan M Davis
jmdavisProg at gmx.com
Fri Aug 9 04:43:43 PDT 2013
On Friday, August 09, 2013 12:43:08 Andrej Mitrovic wrote:
> On 8/9/13, SteveGuo <steveguo at outlook.com> wrote:
> > I suggest that change keyword *for_each* to *for* since *for* is
> > clear enough and
> > less letters, like C++11 does.
>
> Not gonna happen. What's this obsession with less letters? foreach is
> common among many modern languages anyway.
Even if it were better to use for rather than foreach, the reality of the
matter is that at this point in the game, it makes no sense to make changes
like that. It would break lots of code without actually providing any more
functionality or fixing any bugs or design flaws in the language.
Now, on top of that, you _couldn't_ use for in place of foreach thanks to how
crazy versatile D's for loops are (you can put pretty much _anything_ in front
of the first semicolon - including blocks of code with other for loops).
Without foreach, there's no way for the compiler to distintguish between when
you want foreach and when you want a normal for loop. C++ can get away with it
because its for loops aren't as fancy.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list