[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: sunday afternoon whishlist
- From: "Stuart P. Bentley" <stuart@...>
- Date: Wed, 02 Jun 2010 09:22:18 -0700
On Tue, 11 May 2010 11:17:39 -0700, Henk Boom <email@example.com> wrote:
On 11 May 2010 12:50, Roberto Ierusalimschy <firstname.lastname@example.org>
Unfortunately it is not true ;) The expression "#..." does make sense
and has a clear meaning, consistent with #f(x) (and with -f(x), -...,
etc.). And there are no plans to change varargs in 5.2.
One thing I wonder is why functions accept any number of arguments by
default, instead of requiring an exact number (this is a pet peeve of
since I often call functions with the wrong number of arguments by
accident). Functions which require a variable number of arguments (or
optional arguments) could still use ... to get them.
Because Lua doesn't limit the language to accommodate errors. It's better
to be able to do things like use functions as iterators that weren't
designed to take all the parameters passed by the generic for.
If you find you're having a lot of trouble with functions taking the wrong
number of parameters, consider using this:
function argchecked(f, numargs)
if select('#',...)==numargs then f(...)
"%i arguments expected, got %i",