lua-users home
lua-l archive

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

I lost something here? The next phrase after my quote (not quoted here) says that this syntax is not good! (for pure tables)

I would like to stress that the proposal is not about multiple assigments or multidimensinal arrays. It is about to easily ( and fast, due to the extended use of the stack) implemention of these alternatives, as well as many more general cases.

Em 12/09/2015 19:31, "Tim Hill" <> escreveu:

> On Sep 12, 2015, at 11:11 AM, Dirk Laurie <> wrote:
> 2015-09-12 18:58 GMT+02:00 Rodrigo Azevedo <>:
>> 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.