lua-users home
lua-l archive

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


Dirk, if you read through this topic, you'll see that I am well aware of the global metatable trick, which I am using.

However, if you have a project that has config files that are supposed to be "Lua", you either can hardly make additonal rules without getting people wondering or upset, or asking them to make magic like this, which gets you "I don't understand all this" messages.

This is IMHO another core issue the Lua team can only beat so far. That is, "you can make it all you want". At one point you want to have it at some small level to be a Lingua Franca, that is if you know Lua from WoW, you expect it to work the same way in LuaTex.

Especially if people are going to use third party libraries, the "change the language yourself as much as you want" idiom is slowly halting.

For me its for example the trailing comma in function calls we discussed a few weeks back. Its easy for me to change the lua parser, to allow it (it was a one line patch!). However, if I want to use it LuaTex, which is where the issue comes from since tex.print() can have many arguments spawned over several lines, where I often run into issues because of the last argument must not have a comma. Then I'd need to recompile LuaTex. Then I'd need to tell everybody in my team, they'd have to use costum adapted LuaTex package, using different Linux distributions, some are using Windows, so I'd need to change MikTex too...

I could also try and talk to the LuaTex people, which I honestly didn't even try, since I know already its going to be, "we are not a language design project, we're using PUC-Rio Lua as is (except the coroutines stuff they disabled).



On Mon, Aug 11, 2014 at 2:06 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
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.