lua-users home
lua-l archive

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


2018-06-02 0:27 GMT+02:00 Duane Leslie <parakleta@darkreality.org>:

> I agree with this for tables in general too, but I can see the value in one
> of the initial motivations which I believe was to have a reliable arguments
> object rather than the magical `...` syntax entity.

All that the ... syntax does is to bring into the open the fact that such
an object entails overheads, and to offer the user the choice whether to
construct it with {...} or table.pack(...) or not at all, using the admittedly
ugly select(arg,...) mechanism (which looks as if it entails even worse
overheads, but actually is quite efficient).

> Solving this with an immutable tuple is the best path forward in my opinion,
> and something I'd quite like to see, but the issue of tuple equality and
> hashability is not trivial to solve (although related, and could probably
> use a variant of the string interning behaviour).  If I ever find a week
> with nothing to do I might try to implement it.

Not a week: an hour will suffice in Lua 5.3 as long as you restrict the
atoms to things that string.pack can handle. (They have to be restricted
to immutable things anyway.)