lua-users home
lua-l archive

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

在 2015/5/7 4:04, 写道:

What about table constructors as in `return {init = function(self, ...)
return self end}:init()`?

well, since Lua has similar sugars for function calls with a single parameter
of string and of table constructor, it would lead to a similar grammer ambiguity
as to the string case:

this code
  a = b   { some = 'table constructor' } : method()
could either be interpreted as
  a = b;  { some = 'table constructor' } : method()
  a = b{ some = 'table constructor' } : method()

the nerdy Peng / 书呆彭 / Sent from Thunderbird