lua-users home
lua-l archive

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


Declaring all variable access has been discussed before and most people find
it ugly to have to declare access to all functions used (after all they are
just variables in another scope).  Read access to an unknown variable
usually results in an error so those declarations do not have much value.
On the other hand undeclared write access coupled with creation of variables
by writing, leads to all kinds of spooking mistakes.  Make write-to-global
the default for undefined variables and now you've got a global danger
(though of course meta-tables can help).

Declaring all write access seems like a good programming model to me.
Obviously that means declaring all locals and only the globals you write to.

Russ