Loop Match - a syntax for iterative evaluation

Obligatory mention of previous loop-match threads, like Allow the infinite `loop` keyword to prefix expressions w/ blocks - #6 by scottmcm

As for this loop syntax specifically, I don't think it'll happen. There's long been discussion of a dedicated finite state machine syntax that might support some use of continue kinda like this, but I expect loop itself will still stay the same.

The only problem with doing this with recursion is that Rust doesn't have guaranteed tail calls, but the solution there is to add those instead. (And people are indeed already working on them: Support tail calls in mir via `TerminatorKind::TailCall` by WaffleLapkin · Pull Request #113128 · rust-lang/rust · GitHub )

2 Likes