Ideas for shortening "foreach_reverse" (was Re: I have a suggestion.)
Regan Heath
regan at netmail.co.nz
Sun May 20 14:50:47 PDT 2007
Justin C Calvarese Wrote:
> 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 agree that foreach_reverse is way too long for a keyword. Also, it has
> that unslightly underscore.
>
> I think that frr is a little too short. Since it's a keyword that will
> be rarely used, newcomers to D will likely get confused.
>
> I'm "voting" for foreachrev, but here's a whole list of decent
> alternatives to the current "foreach_reverse" mess:
>
> 1. foreachrev
> 2. rforeach
> 3. revforeach
The operator overloads use _r for the reverse version so there is precedent to maybe reuse that here. eg.
opAdd and opAdd_r
That said operator overloads never appear explicitly in code outside the class definition so the 'ugly' underscore never gets seen.
foreach and foreach_r
I don't personally find the underscore ugly in the above case when it's only followed by one letter 'r'.
Regan Heath
More information about the Digitalmars-d-announce
mailing list