lua-users home
lua-l archive

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


> On Sep 12, 2015, at 11:11 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 
> 2015-09-12 18:58 GMT+02:00 Rodrigo Azevedo <rodrigoams@gmail.com>:
> 
>> t1[a,b,c] = 1,2,3
>> equals
>> t1[a],t1[b],t1[c] = 1,2,3
>> For this case. This is NOT syntactic sugar (see below).
> 
> If you can write exactly equivalent Lua code, it is syntactic sugar.
> It is not a swearword, several things in Lua are syntactic sugar,
> 

But what does this buy you? The alternate requires less typing, but I’m no fan of that rationale (APL, anyone?). The existing syntactic sugar in Lua handles two cases: (a) To make function definitions appear to more closely match the syntax of nearly all other modern languages, and (b) to avoid double-entry of potentially complex expressions when calling methods (the last being more than sugar since the expression is only evaluated once). I don’t see anything like this in the proposal; indeed to a naive user the syntax would probably suggest a multi-dimentional array rather than a multiple assignment.

—Tim