lua-users home
lua-l archive

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


пт, 5 июл. 2019 г. в 18:39, Nevin Flanagan <alestane@playsmith.net>:
>
> It seems like what is really wanted is a way to clean up a scope when it closes, so it seems like we should just do that. Create a new block frame, such as "defer ... end" or "exiting ... end". Everything that is in scope at the point where the block begins is in scope throughout the block. However, the contents of the block are not executed inline; rather, once execution reaches the point in the code where the block begins, a deferred-execution guarantee is made for the contained code, which will be executed when the scope immediately containing the exiting ... end block is exited (in newest-guarantee-first order).

Why we try to find new way to do this if it could done with existing syntax.
https://raw.githubusercontent.com/kov-serg/lua-aux/master/scope.lua
More over we could control implementation details with several lines of code.