lua-users home
lua-l archive

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




On 12/15/06, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> Limitations:
> - labels are local to a function, you can't jump from a function to another
> - It's safe to jump out of a loop/block. [...]

Does it take care of closing closures when jumping out of the scope of
a variable which is used by an inner function?

By "local to a function", I really mean "in the very same function, not in a nested one". You can't jump out of a function even if it's an anonymous, local one, so you can't jump through a closure boundary, unless I missed something.

Implementation-wise, the labels list is stored in the current FuncState, and search doesn't propagate to surrounding funcstates.

Gotos and labels were introduced to simplify the implementation of macros which generate hairy control flows, e.g. pattern matching with multiple patterns matching a single case. I never felt the need to interleave them with usual structured control flows.