Dmitry Olshansky:

> I believe it's something that reasonable people may disagree on.
> To me it's perfectly easy to see what return x++; does.

I agree that "return x++;" is not too bad for a human reader, but code with 
mutation inside expressions (mostly written by other people) has caused me tons 
of troubles (and the semantics of ++ and -- are as much undefined in D as in C, 
still). So I usually kit it with fire as soon as I see it.
I'd like to modify the -- and ++ to make them return void. I think Go is 
designed like that.


> or use some std.range primitives ( I think iota does a [begin, end) range)
> foreach( x ; iota(recordRemaining-1, limit+1, -1)){
>       y2 *= top--/bottom--;
> }

Only if you don't care a lot for the performance of that specific loop. (DMD is 
sometimes not even able to optimize foreach() loops as well as for() loops. Go 
figure what it does on iota()).

Bye,
bearophile

Reply via email to