[Pre-RFC] Safe goto with value

Sure, that's why I left "some syntactic form" as another option here, not just TCO.

For example, if loop { state = match state { ... } } works but is optimized poorly, what might, say, a special combined special-fsm-loop-match state { ... } look like? Perhaps it could it continue to different arms? (Lots of bikeshedding possible here, obviously.)

As I read the proposal, it seems to me like it would, for example, enable the goto fail; pattern as mentioned in Tribble's post. It's not clear to me that that would be a good thing, even if it were a case that passed all the MIR validation checks for variable initialization and such.

Does it need to be that open? Could it be a more restricted syntactic form while still being sufficiently usable? Are there cases other than the FSM and external-CFG-translation examples that it would make sense for people to write using a fully-general goto?

3 Likes