[Issue 10765] Cannot Use Index in Foreach When Iteratee is a Tuple
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 7 14:20:48 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10765
--- Comment #5 from monkeyworks12 at hotmail.com 2013-08-07 14:20:46 PDT ---
(In reply to comment #4)
> I know, but you are asking for a change in the D language. It's much simpler to
> add a small range to Phobos or to your project, than to change a language.
I think this should be considered a bug in the language. I'd expect the tuple
version of foreach to work the same as in any other situation, i.e., allow one
to use an index.
> Why they didn't modify the for iteration? They have added a function like
> iterate because it's more orthogonal, allows to keep the language simpler and
> more clean, and it's more explicit in what the programmer wants.
Again, it's only with tuples that foreach with an index works differently. It's
not orthogonal at all to have to use enumerate in one special case.
> So my suggestion it to close this issue down, and to ask people to add an
> enumerate() to Phobos, and in the meantime to use some workaround, like:
I'm currently using a workaround, but I think this is a bug. I'd like to get
another opinion on this.
--
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