Some of these are less actual feature proposals than discussion areas for various supposed Lua warts (which may have multiple solutions)...
Core
Libraries and Functionality
- Standardization for commonly needed non-ANSI C functionality is lacking (e.g. chdir/list-dir, sleep, ...). See StandardLibraries/ExtensionProposal. One suggestion is for Lua to at least define the interface for these function even if it does not include an implementation (for ANSI C reasons).
- BitwiseOperators are frequently needed but are not in the standard Lua distribution. They are frequently requested and there are many competing implementations. These possibly should be included in the standard version of Lua in syntax or as a library.
Syntax
- A macro/syntax-extension facility is commonly wanted. There are various implementations: Metalua[2], luaSub[3], LuaFish, LuaMacro, and token filters.
- ShortAnonymousFunctions are verbose, e.g.
|x| x*x rather than function(x) return x*x end. This is fairly frequently noted.
- StatementsInExpressions are not supported (without resorting to anonymous closures), which limits expressibility and some macro applications.
- CustomOperators are currently not directly supported.
-
continue statements in loops are not available. This has been adked for by quite a few people. See ContinueProposal.
- AssociativityOfConcatenation
.. is right associative and limited to about 200 concatentations (same for ^), which may be a limitation.
- TernaryOperator (conditional expressions as in C's
a ? b : c) are only partly approximated by x and y or b.
- ":" and "." can sometimes be confused -- see ColonForMethodCall.
- ExpressionsAsStatements would shorten some code.
- Constants in octal and binary notation, e.g. 0d81 0o722 0b0101011101011101111, are not directly supported.
- MakeSuperfluousTokensOptional (e.g. '
then' and 'do'). Others strongly objection to this. This seems unlikely except e.g. via token filtering.
- Some Lua's syntax (e.g. ~=) is unfamiliar to those coming from a C language background (!=). ~= is a regex match in Perl. See SyntaxAddition.
Semantics
Expressibility
-
nil and NaN cannot be stored in tables -- see StoringNilsInTables
- Not all objects are fully virtualizable. An object with a metatable currently cannot act as if it were a value of any other type, including the built-in types. LuaVirtualization / GeneralizedPairsAndIpairs
- Varargs and tuples . See VarargTheSecondClassCitizen . This might allow varargs (
...) to be stored and manipulated more easily and efficiently. Also, Rici's immutable tuple type proposal with postfix unpack operator ..., e.g. e = <4,5>; assert(e[2] == 5); assert(#e == 2); a,b,c... = d,e...; assert(c == <5>); assert(<2,3> .. <4> == <2,3,4>); t[<2,3>] = <3,4>; function f(a...) return function(b...) return a,b end end; assert(<f<1,2><3,4>> == <<1,2>,<3,4>>)
- TableScopeBlocks - support new "using..in..end" block to change global scope to table scope
- The FrontierPattern
%f pattern expression is undocumented.
Code Quality/Correctness/Error Handling
- The
module function exposes many warts in module definition: LuaModuleFunctionCritiqued. Possibly eliminate or modify this function.
- Resource clean-up on scope exit would avoid needing to write some programs in an awkward way to ensure correctness (e.g. file handle close upon an exception). See ResourceAcquisitionIsInitialization. try/finally, RAII, and scope exit blocks are proposed.
-
level in error(message,level) is cumbersome to manage. It's not even set in assert -- see LuaCarp.
- DetectingUndefinedVariables is not sufficient for a number of users. The
checkglobals function was recommended for inclusion (in addition to the existing etc/strict.lua and test/globals.lua solutions).
- Sub-issue: Add to the debug library the capability to list the global variables accessed by another function, possibly along the lines of lhf's lbci[4]. See "
checkglobals" in DetectingUndefinedVariables for use case.
- Review Lua scoping (LocalByDefault). Some have recommended that "nothing-by-default" (neither "local-by-default" not "global-by-default). See also in relation to DetectingUndefinedVariables.
Packaging
- Allow the Lua interpreter to locate a script from the module search path. See ModuleExecutionProposal.
- Something like Perl CPAN for Lua is recommended by a number of users. LuaRocks is moving in this direction.
Coding Style
- More comments in the Lua source have been required by a number of people. This may be internal to the source or external (e.g. a book explaining the source code). See LuaSource.
Uncategorized
User Maintained Lists
These user pages maintain lists of feature proposals:
Lua 5.2
See also LuaFiveTwo for comments on what is known about Lua 5.2.
Past Resolved Issues
These issues were closed, retracted, or since implemented.
Lua Patches
Some features have been implemented as a non-standard patch: LuaPowerPatches. Other ideas are implemented in MetaLuaRecipes.
Miscellaneous Examples
This prints "1". Possibly would be better to require that "--[[" comments terminate with "--]]" rather than just "]]".
print(1)
Personal Comments
Can we remove items that are not actually feature proposals from this page (e.g. StoringNilsInTables)? Perhaps start LuaWarts?.
- I've started restructuring this page in terms of various classes of problems each containing some number of identified problems each having zero or more proposed solutions. I think the problems themselves are more important and interesting than any one proposed solution when deciding how the language should evolve. Also, the structure of the ResourceAcquisitionIsInitialization and DetectingUndefinedVariables pages is noteworthy: they similarly describe a problem and follow it by various solutions (including design patterns, patches, metaprogramming/source-filtering solutions, proposed language changes, etc.) and therefore fit this structure well. Still maybe this all belongs on a different page. Not all these problems are necessarily solved by language changes, though the existence of them could be a reason to at least consider language changes.--DavidManura
FindPage · RecentChanges · preferences
edit · history
Last edited April 9, 2008 5:34 am GMT (diff)