lua-users home
lua-l archive

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


I do like this but I feel like it can only work for the
__index/__newindex metamethods where I'd be crazy enough to want it
for most of them.

__mod = function (...) ....

print('%s %s', 'string', 'interpolation')

At least with [] you know very easily where the arglist starts and
stops, it's not ambiguous.  Would be nice :-)

On Wed, Apr 9, 2014 at 11:49 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Thu, Apr 10, 2014 at 8:41 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> Suppose that the notation tbl[i,j,k] meant tbl[i],tbl[j],tbl[k], not
>> as a syntactic sugar, but as genuine multiple indexing overridable
>> by metamethods.
>
> It's a cool idea - I should say, it's still a cool idea since there
> has been at least one thread about it before:
>
> http://lua-users.org/lists/lua-l/2010-10/msg00761.html
>
> People were rather concerned about efficiency at the time - you do not
> want to slow the language down for an occaisional convenience
>
> Also, it makes particular sense when overridden by extended
> metamethods, but what precisely does it mean in their absence?  That
> tbl[i,j] is tbl[i][j]?  That's what I would expect from my old Fortran
> days....
>