[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: sunday afternoon whishlist
- From: Henk Boom <henk@...>
- Date: Sat, 5 Jun 2010 14:29:05 -0400
On 4 June 2010 22:34, Alex Davies <firstname.lastname@example.org> wrote:
> But what about:
> The only solution I can think of is:
> local p1, p2, p3, p4 = returnsmanyarguments()
> expectsfourarguments(p1, p2, p3, p4)
> ... personally I greatly prefer the existing Lua way.
You're right, I hadn't thought of that case. How often does it come up?
I just feel a bit strongly about this because other than accidental
globals (which can be worked out with strict.lua, though it must be
disabled in release for performance), wrong number of arguments seems
to be a common cause of bugs (usually because someone is calling the
wrong function or misunderstanding it), and it doesn't always trigger
an immediate runtime error. It would also help catch mistakes between
. and : at call sites.