lua-users home
lua-l archive

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


> This is a very bad idea. Global-by-default is a fact of life in Lua, and
> it will never change (I hope). You deal it with by practicing
> disciplined programming.

This is not a very useful advice when you deal with code written by
someone else. Global as default and similar things are *obviously* no
such big deal when you live in a vacuum and don't deal with other's
people code. Then you have to just apply good discipline and you're safe.

Unfortunately, based on some replies in this ML, it looks like many
people really don't understand problems that appear only when you have
experience from working with someone else's code, trying to understand
it, debug it or refactor...

Jakub

On 04/07/18 22:39, Gregg Reynolds wrote:
> 
> 
> On Wed, Jul 4, 2018, 12:26 AM Egor Skriptunoff
> <egor.skriptunoff@gmail.com <mailto:egor.skriptunoff@gmail.com>> wrote:
> 
>     Hi!
> 
>     Let me start (n+1)-th thread about "global by default" feature of Lua.
>      
>     My suggestion is to replace "global by default" approach with
>     "nothing by default" by introducing special syntax for accessing
>     global variables:
> 
> 
> Its one thing to introduce a new special symbol that does not change
> existing semantics. It's a whole 'nother thing to "replace" existing
> semantics. You could add $ with special meaning, but then all you've
> done is clutter the language. If you also "replace" existing semantics,
> e.g. by changing global-by-default, then you have by definition defined
> a new language, which is not Lua.
> 
> This is a very bad idea. Global-by-default is a fact of life in Lua, and
> it will never change (I hope). You deal it with by practicing
> disciplined programming.