[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lexical environments
- From: "Juris Kalnins" <juris@...>
- Date: Wed, 03 Feb 2010 08:54:14 +0200
On Wed, 03 Feb 2010 01:08:48 +0200, Gavin Wraith <email@example.com>
I have always found Peter Shook's "Unpack Tables by Name" patch
very convenient with Lua 5.1. You could simply write
local x,y,z in t
in place of
local x,y,z = t.x,t.y,t.z
In Lua 5.2 the syntax of Shook's patch would appear to clash
with that for lexical environments, because after "local x,y,z in t"
the keyword "do" is expected.
It doesn't, the patch consumes 'in' token in the "localstat" context.
So the only change you need is ambiguity checking, like now done with
chained function calls:
do f() end
should be ambiguous. See attached patch which is
modified to compile against work2, and to report ambiguity.
Description: Binary data