lua-users home
lua-l archive

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


The Lua manual in section "2.6 - Visibility Rules" has this to say:

"Notice that each execution of a local statement defines new local
variables."

It wouldn't be a bad idea, IMHO, if this sentence would be changed to
say this is true even for multiple identical local definitions in the
same scope. Explicitly mentioning this feature in section 2.3 would be
even better: in non-trivial functions this unexpected (at least it was
for me) behaviour can cause interesting side effects, as I found out
yesterday evening.

A warning at compile time would alleviate such and similar problems. I
know there's as yet no built-in support for this but I think extending
the parser with a simple warning mechanism (which can be switched off)
plus having it spit out messages for this and similar cases (I suspect,
once such plumbing is in place, that quite a few other "candidates" for
diagnostic messages will rear their ugly heads) might help a few in the
non-Lua-guru department.

-- 
cheers  thomasl

web : http://thomaslauer.com/start