lua-users home
lua-l archive

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


2012/2/18 Gavin Wraith <gavin@wra1th.plus.com>:
> In message
> <CAM=e0-qx_QjGw8D8o0Nm03qOyzZqJEvJ5h3U6ORbjRiAQcD10A@mail.gmail.com>
> you wrote:
>
>> .......  so falling back on RiscLua's
>> minimal version of the patch seems safe...
>
> I first incorporated Peter Shook's patch, in its full form, for RiscLua
> in October 2005, just after Lua 5.1(alpha+) came out. I stuck to that
> but it gradually dawned on me that the only circumstances when I used
> it were in the local case.
> In fact I made a habit of using local variables for everything
> except names of libraries and built-in values (unless they were used
> in loops, where I would use a local value). I found that the patch gave
> pleasingly terse syntax when one was iterating over a list of
> records, e.g.
>
>      for _,record in ipairs(list) do
>        local name,adr,email,job in record
>        display(name,adr,email,job)
>      end
>

So, what about the semantics become a exprlist?
exprlist ::= expr { ',' expr } |
                 namelist 'in' expr

this allows some syntax:
local a, b, c = d, e, f in t
dump(a, b, c in t)
local t = {a, b, c in t}

is this proposal reasonable?


> So eventually I used only the minimal version of the patch. It looks like
> I may have avoided some problems in keeping the patch uptodate by doing
> that.
>
> --
> Gavin Wraith (gavin@wra1th.plus.com)
> Home page: http://www.wra1th.plus.com/
>