[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Say No to global-by-default
- From: Gregg Reynolds <dev@...>
- Date: Wed, 4 Jul 2018 15:39:59 -0500
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.