lua-users home
lua-l archive

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


On Fri, Jan 19, 2018 at 10:37 PM, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Elias Hogstvedt once stated:
>> I'm also wondering if for instance the introduction
>> of [] as a constructor would cause issues with other syntax (backwards
>> compatibility aside) or if these changes could make the C implementation
>> more difficult.
>
>   I wouldn't mind this change---it would signal intent better in my opinion.
>
>   -spc
>

It would introduce a syntactic inconsistency. x"1" and x{1} are both
unambiguously function calls, but x[1] is a table lookup, and x[1,2]
is a syntax error.

If you want to tag your constructor syntax, consider:

def list(t): return t
x = list{1, 2, 3}

/s/ Adam