[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.2 #... proposal and patch.
- From: David Kastrup <dak@...>
- Date: Mon, 02 May 2011 10:51:23 +0200
Benoit Germain <bnt.germain@gmail.com> writes:
> Hello,
>
> Currently, when a vararg function needs to know the number of vararg
> parameters it got, one must use
>
> select( '#', ...)
>
> On the other hand, the seemingly innocent idiom
>
> local n = #...
> I find rather awkward to be obliged to resort to a function call just
> to be able to count the number of elements or to extract one such
> element in a language construct when the VM has all the required
> information.
What makes you think the former is a function call and the latter not?
> It also breaks my heart when I think about all the stack adjustments
> that go on under the hood just because of that function call :-).
Have you actually looked at the generated byte code?
--
David Kastrup