[Issue 4508] tuples should be indexable with foreach over range

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 20 09:10:55 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=4508

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #3 from ag0aep6g at gmail.com ---
(In reply to Nick Treleaven from comment #2)
> `foreach (e; seq)` works at compile time for an AliasSeq, so I don't see why
> `foreach (i; low..high)` can't make `i` known at compile-time if the bounds
> are known.

Can `i` be made known at compile-time without unrolling the loop (in the
binary)? Surely we don't want to unroll every loop that can possibly be
unrolled. For example, it would be very surprising if the compiler unrolled a
loop like `foreach (i; 0 .. uint.max) writeln(i);`, generating gigabytes of
machine code.

--


More information about the Digitalmars-d-bugs mailing list