lua-users home
lua-l archive

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


On 10 July 2015 at 10:50, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
> On Fri, Jul 10, 2015 at 2:38 AM, Coda Highland <chighland@gmail.com> wrote:
>>
>> On Thu, Jul 9, 2015 at 4:30 PM, slayer beast <slayerbeast@gmail.com>
>> wrote:
>> > I would love to have a syntax like this:
>> >
>> > some_table['a_name', 'another'] = a, b
>>
>> Sadly this conflicts with one of the suggestions for the tuple-keyed
>> table proposal. We can't have them both.
>
>
> This is tuple-keyed assignment:
> some_table['a_name', 'another'] = c
>
> And this is two distinct assignments:
> some_table[ ('a_name', 'another') ] = a, b
>
> Old good idea: parentheses mean converting a tuple to a single value.
>

Neither translate well to the __newindex metamethod.
__newindex = function(t, k, ...)
Is the ... extra keys follows by a value, or multiple values

I'd prefer that we limited it to a single value.
This way it isn't ambiguous; but it's still awkward (optional middle
arguments... ew!)