what? I didn't say anything about metatables. my issue was specifically with syntax so yes, the parser is all that is concerned. I never stated that the colon syntax doesn't work on variables(in fact I stated just the opposite that it only works for variables and '(expr)' type expressions). No 3:somthing() wouldn't make much sense but I'm arguing the consistency of the syntax not semantics.The parentheses are merely for grouping, it's just a limitation of the parser. That said, everything is treated the same, (table):method() works too, and the colon syntax works for every kind of variable. Now, what you are mistaken not being able to use it for, is not being able to set a metatable. (So (3):something() could work, but since you can't set a metatable, you can't tell it where to look.)
my argument is that there should be a production like...
Code: Select all
primaryexp ::= Number
| String
| tableconstructor
| nil
| false
| true
| '(' exp ')'
there is at least 1 ambiguity that arises from my idea but it could be resolved without harm to existing code
the production(from the Lua manual)
Code: Select all
args ::= `(´ [explist] `)´ | tableconstructor | String
Code: Select all
args ::= `(´ [explist] `)´ | primary_exp
edit:
also when I said "special function call syntax" I wasn't very clear; I meant when you don't have to use () becuase you only have 1 argument and it's either string literal or table constructor.