lua-users home
lua-l archive

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


Diego Nehab wrote:
Hi,

What were the design motivations leading to all variables being global, and limiting them to the block scope only when 'local' is used ? Why not the reverse (all variables local to block scope expect where noted 'global') ?


You can read about the great "Globals-Locals by default" war anywhere between these two threads:

    4 Aug 2005
    http://lua-users.org/lists/lua-l/2005-08/msg00132.html

    14 Nov 1997
    http://lua-users.org/lists/lua-l/1997-11/msg00018.html

Hundreds of good programmers have been killed in the conflict.
In the end, the "Globals" tribe won.  Let's not start another one...

In the second incarnation of this battle I came in swinging for the "locals-by-default" corps and was quickly converted to the other camp with this single missive:

   http://lua-users.org/lists/lua-l/2005-08/msg00139.html

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
(650) 941-9040          mP     b'                            , 1$'
M1      ,.`           ,b`    ,`                              :$$'
     ,|`             mP    ,`                                       ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'