lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Aug 21, 2022 at 4:17 PM Philippe Verdy <verdyp@gmail.com> wrote:
for<label> ... do
   while<label2> ... do
      repeat<label3> ...
         if ... then
            break<label3>
         else
            break<label>
         end
      until ...
      continue<label> ...
   end
   continue<label>...
end

For deeply nested loops that might enjoy this type of syntax, label naming would be an unneeded facet of thought. I also think it obfuscates where the label is, and where the condition is. Simpler versions of the syntax, like "break N" and "continue N" are really easy to implement because you can merely loop backwards through the linked list of BlockCnt structures and stop after you discover the intended enclosing loop. This does require you patch the BlockCnt structure to fix a jump just before the block ends, though.