lua-users home
lua-l archive

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

As several people have suggested, the next version will be 5.0. We are
still planning to realease it (at least an alpha version) by May, but we
are not sure we will be able to do that. Anyway, we are trying to fix
some decisions. So, following is a list of the main differences from
lua4.1w4 to Lua 5.0. Most of them have been discussed in the list

- "generic for": will have an implicit state, so that for several common
uses you don't need a new closure for each `for'.

- co-routines: basically as it is, but we will try to allow for `yield's
inside linehooks.

- metatables: as it is now, but the keys will be prefixed with '__'
(e.g. __gettable, __settable, etc.) The main ideia is to facilitate
finding parts of the code that deal with metatables.

- error handling: we will probably change functions related to error
handling (dostring/dofile, call, etc.). We will have a proposal soon.

- standard libraries: standard libraries now use "namespaces". So,
strfind now is str.find, sin is math.sin, fileopen is Some
basic functions (type, assert, error, etc.) are still global. We also
changed the io library; e.g. files act as objects (f =;
f:read(...); f:write(...)).

- declaration of globals: we introduced global declarations:

    global a,b,c
    global a,b,c in T
    global in T        -- change the default

So, "global in nil" forces declarations for every variable;
"global in {}" puts all undeclared variables into a private table;
"global sin, cos in math" allows the unqualified use of the
names "sin" and "cos".

- we introduced a "lightweight userdata", which is a value and not an

- require: the path now specifies "templates", instead of directories.
For instance, require "A" with path "./?.lua;./?.lc;/usr/local/?/init.lua" 
will look for "./A.lua", "./", and "/usr/local/A/init.lua".

What is still missing?

- "partial orders": the bug in comparisons with NaN must be solved. That
implies in not reducing other comparisons to "lt", and so probably the
solution will also change the "lt" tag method.

- the declaration "global in nil" forces the declaration of *all* names.
So, even basic functions like "type" and "error" should be declared. It
would be good to have some scheme to "pre-declare" some identifiers...

-- Roberto