lua-users home
lua-l archive

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


> So maybe it is documented in some internal TeCGraf docs...

That should be in the manual; our fault...

> So, to Lua authors: are you willing to consider adding
> object-style declaration in a function to next release
> or is it a behavior you want to keep ?
> Would the changes to the parser be too important ?

The changes are trivial: all you have to do is to *remove* the lines

      if (ls->fs->prev)  /* inside other function? */
        return 0;

in function "stat" (lparser.c:762). That is, we explicitly forbid this
kind of declaration. When you allow this kind of nesting,
missing `end's are only detected at the end of the file:

  function foo ()
    if bla then blu    -- missing end!
  end

  function foo1 ()     -- would be ok, inside foo

  -- follows many lines with other function definitions
  ...
  -- eof: only here that missing end is detected

Because of that, we decided to forbid this syntax. We are not sure about
this decision, but it is always better to add it later than to remove
it later.

-- Roberto