On Thursday, 10 January 2013 at 02:04:57 UTC, ixid wrote:
On Wednesday, 9 January 2013 at 23:15:10 UTC, Jonathan M Davis wrote:
On Wednesday, January 09, 2013 05:38:16 ixid wrote:
A very minor change that would be elegant and easy for beginners:

foreach(i;5)
//stuff

Allowing just a single number to mean the end point and a default
starting point of zero is assumed, just as with iota it's
possible to write it iota(5) or even 5.iota, it assumes unless
otherwise specified that you mean 0 to be the starting point.
Would this be a reasonable enhancement request for me to make or
does it collide with something?

I would argue that the mistake is that iota(5) works. That's not at all clear,
and

foreach(i; 5)
//stuff

is no better. Regardless, all such an enhancement would do is save you a little bit of typing. It adds no actual functionality to the language, so I _really_ don't think that it makes sense to implement anything like that.

- Jonathan M Davis

Regardless of this particular suggestion's value, I think you're wrong to dismiss readable terseness and saving typing as mattering, it's one of D's advantages over C++ that it makes a lot of things far easier to do and understand because they're not a horrid mess.

I don't think Jonathan was (merely) dismissing readable terseness and saving typing. IMO he had more pertinent reasons why

foreach(i; 0 .. 5)
{}

is very nice, *as is*.

Reply via email to