[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: local variables and scope
- From: Olivier Mascia <om-lists@...>
- Date: Thu, 25 Aug 2005 17:14:22 +0200
Follows a nice script to detect missing "local" declarations and other
"wrong" uses of global variables.
Simply put it in your path and add require"strict" to your program
(or call "lua -lstrict").
-- checks uses of undeclared global variables
-- All global variables must be 'declared' through a regular
-- (even assigning nil will do) in a main chunk before being used
-- anywhere or assigned to inside a function.
Are there considerations for a future major release to have this
strict behaviour a default of the language? Wouldn't it considerably
help using mainly local variables except where global trully
intended? Could this strictness be enforced (by default in a future
major version or optionally in a future minor version) at byte-code