This one weird trick allows you to capture loop variables.

Timon Gehr timon.gehr at gmx.ch
Sun Oct 20 22:45:24 UTC 2024


On 10/20/24 04:29, Walter Bright wrote:
> I'm a bit sorry I implemented opApply.

I am not.

> The conversion of the loop body 
> to a lambda is a tricky beast, and in general such complex rewrites are 
> not a good idea. The language should be straightforward.
> 

As someone who has also implemented `opApply`, I do think it is quite 
straightforward. It's just internal iteration with support for multiple 
ways to exit the loop, encoded using numerical indices.


More information about the Digitalmars-d mailing list