-
Couldn't load subscription status.
- Fork 13.9k
Description
This idea has come up before, but #1905 reminded me that we never really reached agreement on it. I propose adding a new looping construct, forever [block], that has the same semantics as while (true) [block]. The reason to add a special construct would be to allow typestate to recognize that infinite loops run forever, and not yield spurious-looking errors (see #1905 for an example) about functions not returning a value. The current workaround is to do while (true) { ... }; fail "Unreachable";, which isn't terribly burdensome, but is annoying.
I realize we're trying not to add stuff, but this issue seems to be a source of confusion, and while (true) loops seem to be pretty common.