lua-users home
lua-l archive

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

On 1/26/06, Alen Ladavac <> wrote:
> From: "Ben Sunshine-Hill" <>
> >There isn't necessarily any context, because blocks aren't always
> >Introduced by if, while, etc. Take the code { a = 1 }. Table
> >constructor or block?
> If the statement terminator was mandatory, then it would clearly be a block
> because it's at the start of the statement. But really, I was not asking
> about freestanding blocks, but about if <condition> then <statements> end
> being sugared as if <condition> { statements } (same for while, for,
> function, etc). I believe this does have quite a context right?

It's still ambiguous. "if(a) { b = 1 }" is likewise either a
brace-delineated if statement, or a table constructor in an
unterminated if statement. So you'd have to do away with the standard
method of marking blocks altogether for such statements. Which means
you'd have one syntax for if-blocks, and another for freestanding
blocks. Blech.