lua-users home
lua-l archive

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


On Sun, Jun 2, 2019 at 4:21 PM Philippe Verdy <verdy_p@wanadoo.fr> wrote:
> It's another good case, because x is not used after print(x), it's no longer needed and a smart compiler can mark it as dead to reuse its slot in the current closure.

No, it cannot, as it is accesible and so not-dead according to the manual.

> It's the role of a compiler to track variable usages accesses in each scope, and discard unneeded variables or variables that are no longer accessed, in order to reduce the memory footprint and properly allocate as few slots as possible in each scope.

Also it's the role of the compiler to implement the language as
defined, no as it is more convenient for it.

Francisco Olarte.