[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: get_local() and "(for index/limit/stop)"
- From: Rici Lake <lua@...>
- Date: Sat, 18 Sep 2004 12:19:22 -0500
On 18-Sep-04, at 10:27 AM, David Given wrote:
The _ idiom does *part* of this, but it can occasionally trip you up
because it doesn't do what you expect it to do.
I guess that depends what you expect it to do :) My point was that you
can use any arbitrary local name at (almost) no cost:
local unused, unused, capture = string.find(str, pat)
local _, _, capture = string.find(str, pat)
No magic required.
I wasn't proposing making life easier for the compiler; rather the
contrary. I was suggesting that it would be reasonably easy for the
compiler to optimise away unused variables if someone wanted to do
that; I doubt that it would make an observable difference in execution
time, though.
I personally like the _ convention, but I don't think the language
should insist on it.
R.