lua-users home
lua-l archive

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

> The implementation of lfs.dir in LuaFileSystem does close the
> directory handle as it reaches the last element. Unfortunately, that's
> not good enough, because of course, when given a "for" iterator, users
> can (and do) use "break".

That is true. And directory iterations are frequently broken (e.g.,
after finding something). However, as just pointed out in another
thread, none of the proposed mechanisms for deterministic finalization
would be practical for that case, because the variable that needs
finalization is hidden inside the for (or worse, hidden inside the
closure or coroutine used by the for).

-- Roberto