lua-users home
lua-l archive

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


2014-08-11 13:33 GMT+02:00 Axel Kittenberger <axkibe@gmail.com>:
>> Any language in which interactive use for tiny one-off jobs
>> is a design objective cannot afford to make undeclared
>> variables illegal. People just won't use it.
>
>
> This is the dichotomoy at its core. One group wants to write small
> scriptlets while the other writes large(r) software projects. One-off jobs
> is a very extreme example.

Well, I do both. I have a 1600-line Lua program with near the top:

local meta_ENV=getmetatable(_ENV)
setmetatable(_ENV,{__newindex = function (ENV,name,value)
   logfile:write(where(2),"Assigning _ENV.",name,"\n")
   rawset(ENV,name,value)
end})

and near the end,

setmetatable(_ENV,meta_ENV)

If there is anything whatsoever in `logfile`, I get worried.

Point is, Lua allows tricks like the above to those who
need them, when they need them, without inflicting them
on people who at that moment, don't.