[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RFE: refman - adding mention of os.exit not closing variables with default arguments.
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Tue, 23 Jun 2020 12:01:22 +0200
Hi Lua Team!
Sorry for bringing this up again, but I think it is important, and maybe
it was swamped by other threads.
In another thread it was discussed that calling os.exit without a "true"
second argument won't close pending "to close" variables because the Lua
state will not be closed itself.
This fact is not mentioned explicitly in the manual, i.e. the inference
that non closing the main Lua state won't close those vars.
This is not an easy inference to do, also because section 3.3.8 goes a
long way to explain other ways those variables will or won't be closed.
So a reader, especially a pure Lua programmer, would be highly
surprised, IMO, if calling os.exit() /won't/ close any pending vars.
I think that an explicit mention of this behavior should be made both in
3.3.8 AND in os.exit docs.
Something on these lines:
Note that calling os.exit without closing the Lua state won't close any
If the optional second argument close is true, closes the Lua state
before exiting and also closes any pending to-be-closed variables.
To-be-closed variables are a new feature and a safety- and data
integrity-related one so, IMO, users should be given extremely clear
information on what are the guarantees of the new mechanisms, otherwise
they could get a false sense of security and put nasty bugs in their
BTW, are there any undocumented cases in which to-be-closed variables
could not be closed?