lua-users home
lua-l archive

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


Doug Currie said:

> That was not my proposal.
> This syntax is not #... it is # <function call>.
>
> The debate seems to be between those who like #... as special syntax
> for "length of multiple value arguments," and those who read it as
> "operator # applied to the first value in the multiple value
> arguments."

While I'm not particularly fond of select("#", ...), I really don't like
magic #...  There is enough magic in ... as it is :) # is a prefix
operator like - and not, and it should behave exactly the same way as they
do.

In any event, there are few use cases for finding the argument count which
do not involve iterating over the arguments; I would far rather have:

  for i, arg in ieach(...) do process(arg) end

than

  for i = 1, select('#', ...) do process((select(i, ...))) end

or any variation on that theme, including #...

Also, ieach would be a handy function to have, independent of ..., since
you could use it to iterate over multiple return values of a function, or
any other list of values.