[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: modifying current execution line/opcode
- From: Fabien <fleutot+lua@...>
- Date: Fri, 15 Dec 2006 11:53:40 +0100
On 12/15/06, Roberto Ierusalimschy <firstname.lastname@example.org> wrote:
> - 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.