DIP 1010--Static foreach--Formal Review
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 11 16:21:48 PDT 2017
On Tue, Jul 11, 2017 at 07:18:51PM -0400, Steven Schveighoffer via Digitalmars-d wrote:
[...]
> 3. The only controversial part I see is that `break` doesn't break
> from the foreach loop. While I agree with the reasoning, and support
> that concept, the truth is we currently have a "poor man's" static
> foreach using a foreach over a tuple, and that DOES break from the
> loop.
This is a false impression. It actually does not break from the loop,
but inserts a break in the generated code, and continues to unroll the
rest of the loop. It's only at codegen that the subsequent iterations
are detected as dead code and elided. See:
https://wiki.dlang.org/User:Quickfur/Compile-time_vs._compile-time#.22static.22_foreach_does_NOT_interpret_break_and_continue
T
--
Любишь кататься - люби и саночки возить.
More information about the Digitalmars-d
mailing list