lua-users home
lua-l archive

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

Mark Hamburg wrote:

> 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.

This may be no surprise to you, but I think what Rici was
pointing out was that your second example actually
subdivides into two examples.  (In other words, the
underscore identifier itself doesn't really enter into it.)
So here are all three:

  -- #1 -- One scope with duplicate identifiers (or at least
  -- there's only one 'local' keyword, but I don't know how
  -- that's dealt with internally):
    local foo, foo, bar = somethingorother() -- Each foo is
      -- a junk variable.

  -- #2 -- "Improperly" nested scopes (they begin in
  -- different places, but end in the same place -- no big
  -- deal except for the duplicate identifiers):
    local foo = somethingorother()
    local foo = somethingelse()

  -- #3 -- Properly nested scopes (they end in different
  -- places):
    local foo = somethingorother()
      local foo = somethingelse()

I would not mind too much if #2 was prohibited; I can't
think of a practical use for it.  However, allowing it does
seem more orthogonal.

On the other hand, I use both #1 and #3 and would not like
either of them to be prohibited.