[Issue 1553] foreach_reverse is allowed for delegates
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 1 19:43:31 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1553
--- Comment #9 from Vladimir Panteleev <thecybershadow at gmail.com> 2011-07-01 19:38:33 PDT ---
(In reply to comment #8)
> But why couldn't a delegate be written for reverse iteration?
So put the semantics in the delegate name, instead of expecting the user to
always use the correct one of the two semantically-opposite but actually
synonymous keywords. This can easily become a point of confusion, and I'm
surprised I need to elaborate in so much detail why this is plain bad.
What's wrong with writing it like this?
foreach (v; &foo.reverseIterator) { ... }
If you start writing it like this:
foreach_reverse (v; &foo.reverseIterator)
Sooner or later someone will forget the second "reverse", the code will look
and compile right, and work wrong!
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list