lua-users home
lua-l archive

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

HyperHacker <> writes:
> It seems troublesome to me:
> local x, y, z = a, b, c in t
> does that parse as: local x, y, z, = t.a, t.b, t.c
> or as: local x, y, z = a, b, t.c ?
> In the former case, there's no way to access anything *not* in t

So?  Write two "local" statements then...

> in the latter, it's not very useful.

Thus it must be the former ...

> Not to mention, the parser has to read ahead an arbitrary number of
> tokens to see where it's meant to pull these names from.

Yeah, the main problem seems to be that it's not clear in which mode
it should be reading the list of values -- "in" mode, in which case
they all have to be simple names, or "normal mode", in which case they
can be arbitrary expressions.  For Lua's simple parser that might be a
bit much to ask.

I suppose some variant that puts the "in ..." first would be more

   local x, y, z = in t: a, b, c

or something...


On a bad day, I see brewers still talking as though all beer were
consumed in the pub, by the pint -- by insatiably thirsty Yorkshire
steelworkers who have in reality long ago sought work as striptease
artists.  [Michael Jackson]