lua-users home
lua-l archive

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


Note that the syntax <const,close> is still not allowed in the current beta doc, which allows a single optional attribute between angle brackets (the comma is not described or may be reserved for later addition of attribute-specific parameters) and also does not allow adding multiple bracketed notations if there are multiple attributes.


Le sam. 5 oct. 2019 à 15:42, Rodrigo Azevedo <rodrigoams@gmail.com> a écrit :
Why not use a simpler model for <close> variables as a simple
mechanism of a predictable call of __close() from its respective
value?

e.g.:

do
  local x <close> =  whatever
  x = something -- it's OK
  local y <const,close>  = true
  -- y = false -- compile-time error

  -- going out-of-scope
  -- call __close(), if it exists, from 'something' value.
  -- call __close(), if it exists, from 'true' value.
end -- end-of-scope

Namely, it does not imply <const> or checks before variables are out-of-scope.
If we want <const>, just explicitly declares it.

--
Rodrigo Azevedo Moreira da Silva