lua-users home
lua-l archive

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


  t= { y = sin x };
  t= { y = sin, x };
Lot of ambiguities will happen, even when you don't specify the keys:
  t = { sin 0 };
  t = { sin, 0 };
or:
  t = { 12 - 1 };
  t = { 12, - 1 };
The way by which semicolons were made optional between statements in Lua is already broken, but more limited; the colon separators in table data initializers would be much worse (in fact there are all the same ambiguities if you drop the semicolons between function parameters, or between return values, or between multiple right-hand side values of an assignment, it would make the language extremely ambiguous with lots of caveats in the parser, or forcing it to use backtrailing and maintaining a complex structure to memoize the backtrailing state)

Le ven. 16 août 2019 à 23:37, nobody <nobody+lua-list@afra-berlin.de> a écrit :
On 16/08/2019 23.25, Sergey Kovalev wrote:
> Lua allows to separate statements with semicolons. Will it break
> anything if lua will behave same way with tables?
>
> t={ a=1 b=2 c=3 }

t = { u = v [w] = x }

-- nobody