I have a suggestion.

Mikola Lysenko mclysenk at mtu.edu
Wed May 16 12:35:36 PDT 2007


YonggangLuo Wrote:

> i think it's will be a good idea to replace "foreach_reverse" with  "frr".
> "foreach_reverse" is too long as a keyword


I like this idea, but "frr" is downright inconsistent with the rest of the language.  What if we do something like this:

~foreach( x; arr )

While reducing keystrokes, recycling a unary operator also cuts down keyword bloat.  My only concern is that it might be too subtle.  I suspect that for non-English users, there would be few tears shed over the death of "foreach_reverse."

Ultimately, the best option might be to do as Tom S. and others have suggested and simply axe it entirely.  Using a clever template you could actually implement a very efficient reverse foreach within the standard library.

-Mik



More information about the Digitalmars-d-announce mailing list