[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.4.0 (alpha) now available
- From: Francisco Olarte <folarte@...>
- Date: Sat, 22 Jun 2019 16:27:10 +0200
Sony:
On Fri, Jun 21, 2019 at 10:42 PM Soni "They/Them" L. <fakedme@gmail.com> wrote:
...
> I'm convinced <toclose> should support nested contexts (read: have an
> __enter).
Do you realize you can do "local <toclose> x = ctx.__enter()" ( and
have enter return either self or a helper object )
I think the behaviour is enough, mechanism, you cannot do the
equivalent of <toclose>, but enter is trivial and in fact there are
things like Java which are dessigned to work this way ( try with
resources, which is very similar to <toclose> ).
> I have, many times, used file:lines() (which is more like
> file:read_iter() because you can give it args) in a loop that I would
> break out of, and then I'd use the file some more.
Then do it, it is simple. do, local toclose = file.open, for loop with
may break , some things wihich happen after it, end. No need for enter
anywhere.
Francisco Olarte.