Thread overview
[Issue 7361] No documentation for front tuple expansion in foreach over range
Aug 31, 2014
Vlad Levenfeld
Aug 31, 2014
Vlad Levenfeld
Aug 31, 2014
Vlad Levenfeld
Mar 13, 2016
Nick Treleaven
Dec 17, 2022
Iain Buclaw
August 31, 2014
https://issues.dlang.org/show_bug.cgi?id=7361

Vlad Levenfeld <vlevenfeld@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vlevenfeld@gmail.com

--
August 31, 2014
https://issues.dlang.org/show_bug.cgi?id=7361

--- Comment #2 from bearophile_hugs@eml.cc ---
So I think it's better to not document this anti-feature.

--
August 31, 2014
https://issues.dlang.org/show_bug.cgi?id=7361

--- Comment #3 from Vlad Levenfeld <vlevenfeld@gmail.com> ---
I'm not sure its such an anti-feature - I keep having "cannot infer argument types" bugs using foreach on custom ranges, and zipping them with an enumeration sequence beforehand seems a pleasant nice enough workaround.

(To be fair this may be fixed in 2.067 but I don't know because 2.067 segfaults on my codebase and I haven't had time to hunt down the cause yet.)

In any case I feel it should either be documented or removed because it caught me by surprise and took a little bit of time to figure out what was going on, mainly because the lack of documentation.

--
August 31, 2014
https://issues.dlang.org/show_bug.cgi?id=7361

--- Comment #4 from Vlad Levenfeld <vlevenfeld@gmail.com> ---
sorry I meant 2.066

--
March 13, 2016
https://issues.dlang.org/show_bug.cgi?id=7361

Nick Treleaven <ntrel-pub@mybtinternet.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ntrel-pub@mybtinternet.com

--- Comment #5 from Nick Treleaven <ntrel-pub@mybtinternet.com> ---
While it's not documented in the spec, this feature is already documented in an example in std.range.enumerate:

http://dlang.org/phobos/std_range.html#.enumerate

    foreach (lineNum, line; stdin.byLine().enumerate(1))
        stdout.writefln("line #%s: %s", lineNum, line);

--
October 15, 2016
https://issues.dlang.org/show_bug.cgi?id=7361

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |andrei@erdani.com

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=7361

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
May 16
https://issues.dlang.org/show_bug.cgi?id=7361

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Nick Treleaven <nick@geany.org> ---
Initial docs were added in https://github.com/dlang/dlang.org/pull/3001.

Improvements: https://github.com/dlang/dlang.org/pull/3832

--