lua-users home
lua-l archive

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

Okay. "_" is a good example. I'm not as squeamish about treating it as a
special case, however, if it's the primary reason to use the facility.

If one still allowed hiding in nested scopes, then I think the other uses
could be covered at the expense of having to introduce explicit do blocks.


on 11/11/04 9:46 AM, Rici Lake at wrote:

> On 11-Nov-04, at 11:54 AM, Mark Hamburg wrote:
>>  Is it useful to be able
>> to capture a variable and then create a new variable with the same
>> name in
>> what appears to be the same scope?
> My most common use of the idiom is the following:
>  local _, _, capture = string.find(str, pattern)
> If you couldn't use nested local's, this would be illegal (and most of
> my code would break).
> Special casing _ strikes me as not a good idea, but perhaps some would
> like that.
> R.