lua-users home
lua-l archive

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

In the generic for statement pseudocode, could explist return a 4th, optional result which is assigned to a scoped variable?  I assume a scoped var with value nil is a no-op on exit.

       local f, s, var, exit_f = explist
       local scoped _exit_f = exit_f
       while true do
         local var_1, ···, var_n = f(s, var)
         if var_1 == nil then break end
         var = var_1

On Sat, Jul 21, 2018 at 7:55 PM, Roberto Ierusalimschy <> wrote:
> >From the land of PEP: deterministic cleanup for iterators
> Can the prospective scoped locals be applied to this use case?

No. The proposed 'with' clause also does not seem to apply :-)

-- Roberto