[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [PROPOSAL] multiple keys/values with function metamethod
- From: Tim Hill <drtimhill@...>
- Date: Sat, 12 Sep 2015 15:30:43 -0700
> On Sep 12, 2015, at 11:11 AM, Dirk Laurie <firstname.lastname@example.org> wrote:
> 2015-09-12 18:58 GMT+02:00 Rodrigo Azevedo <email@example.com>:
>> t1[a,b,c] = 1,2,3
>> 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.