lua-users home
lua-l archive

Re: proposal: state machine syntax also usable for continue / nested break

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


On Fri, Jan 28, 2011 at 12:03 AM, David Manura <dm.lua@math2.org> wrote:
> I don't local variables can completely replace labels in the above
> proposal (as opposed to [1]).  However, my above suggestion for
> implicitly naming variables could incorporate the loop variable name
> in the label.  Therefore, :forfor: could be replaced with :kk: .
err, correction: don't -> don't think; naming variables -> naming
labels. In other words, this would be consistent with the proposed
semantics:
 for kk, vv in pairs(tt) do
 for k, v in pairs(t) do
 if condition1 then break end -- same as `break :k:`
 if condition2 then break :continue: end
 if condition3 then break :redo: end
 if condition4 then break :kk: end
 end
 end

AltStyle によって変換されたページ (->オリジナル) /