4 ms·
Lua added goto just recently, and it's benign, because it can't escape its calling context. Users were agitating for `continue` to join `break` for control flo
by samatman 9y ago
Lua added goto just recently, and it's benign, because it can't escape its calling context.
Users were agitating for `continue` to join `break` for control flow interruption. Lua instead chose to provide all the non-structured control flows you would like as a primitive; scoping it lexically keeps it from breaking composition.
- ufo 9y agoI still hope that we might be able to convince the Lua authors to add continue one day. It would be very convenient. I think the real reason why it hasn't been added to the language yet is that it has a weird interaction with the way Lua scopes its repeat-until loops. The justification about having a single control-flow structure is more of an excuse.
- samatman 9y agoAs a contrasting opinion, I would like the break keyword to be formally defined as a sugar for a special labeled goto. Since it's a keyword, you can't create your own ::break:: label, so that would be fine.
- ufo 9y agoI'd be OK with that. But let me type `break` and `continue`, with all the sugar that entails :)