lua-users home
lua-l archive

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

On Tue, Feb 12, 2013 at 7:17 PM, Peter Slížik <> wrote:
Okay, here's the new thread I announced a while ago...

Lua-users wiki cites Roberto's words:

"Local by default is wrong. Maybe global by default is also wrong, [but] the solution is not local by default."

Could anybody who understands Lua innards elaborate?

FWIW, I think this is a language design problem, rather than anything to do with implementation internals. Can't speak for Lua specifically, but having designed and implemented a similar language, I've been over this, and my conclusion is that both ways are dangerous tricks to avoiding some typing. What I did is require explicit keywords for all declarations. That is, you cannot accidentally use an existing variable when you intend to declare a new one, or vice versa, because you're explicitly telling the compiler what you intend to do.

TL;DR: Implicit behavior is dangerous.

//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.--- Games, examples, libraries, scripting, sound, music, graphics ---.
|   |