2 ms·
For the version issue, I have to say when I started to research Lua, there's only 5.2 BNF I can find on the internet. So I decided to try it from 5.2. Of course
by nalaginrut 10y ago
For the version issue, I have to say when I started to research Lua, there's only 5.2 BNF I can find on the internet. So I decided to try it from 5.2. Of course, I'm willing to catch up with the newer version.
For ISSUE-1. Yes, I know it may break the compatibility of some existing code.
The problem is why people reference a variable named 'self' but not expect it to be the current table? People may named a var as 'self' to hold other value. I think that is the problem. 'self' is actually a reserved word in Lua, but Lua permit it to be used for other value. I don't think it's good. For example, some Scheme implementations allow users redefine primitives, you may redefine '+' with '-'. It's interesting, but it's bad when you want to build serious program.
Another point is mentioned in the article that people could easier find the error when they encountered an exception related to 'self'.
Anyway, my point is that a good Lua programmer should avoid to use a.b.c.foo() if one wants to get the current table, no matter how the function is defined (colon or point). But people always do wrong thing (include me), so why not provide a mechanism to let them avoid this problem? Fixed ISSUE-1 could let people get rid of this problem, even you make the mistake to use point reference on 'self', you can get correct value if you defined the function with colon.