Releases: lua-stdlib/lua-stdlib
[ANN] released stdlib 41.2.1
stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.
I am happy to announce release 41.2.1 of stdlib.
stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib
Noteworthy changes in release 41.2.1 (2017-08-07) [stable]
Bug fixes
std.versionreports the correct release again
Install it with LuaRocks, using:
luarocks install stdlib 41.2.1 [ANN] stdlib 41.2.0 released
stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.
I am happy to announce release 41.2.0 of stdlib.
stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib
Noteworthy changes in release 41.2.0 (2015-03-08) [stable]
New features
New iterators,
std.npairsandstd.rnpairsbehave likestd.ipairsandstd.ripairsresp., except that they will visit all integer keyed elements, including nil-valued "holes". This is useful for iterating over argument lists with nils:functionfn (a, b, c) for_, vinnpairs{...} doprint (v) endfn (nil, nil, 3) --> nil nil 3
New
debug.getfenvanddebug.setfenvthat work with Lua 5.2 and 5.3.debug.argscheckwill skip typecheck forselfparameter if the function name specification contains a colon.New
debug.resulterroris much likedebug.argerror, but uses the message format "bad result #n from 'fname'".New
debug.extramsg_mismatchto generateextramsgargument fordebug.argerrorordebug.resulterroron encountering a type mismatch.New
debug.extramsg_toomanyto generate a too many arguments or similarextramsgargument.
Deprecations
debug.toomanyargmsghas been deprecated in favour of the more orthogaldebug.extramsg_toomanyapi. You can rewrite clients of deprecated api like this:ifmaxn (argt) >7thenargerror ("fname", 8, extramsg_toomany ("argument", 7, maxn (argt)), 2) end
Bug fixes
std.getmetamethodno longer rejects non-table subjects when_DEBUG.argcheckis set.functional.bind,functional.collect,functional.compose,functional.filterandfunctional.mappropagate nil valued arguments correctly.functional.callableno longer raises an argument error when passed a nil valued argument.debug.argcheckanddebug.argscheckaccept "bool" as an alias for "boolean" consistently.io.catdirandio.dirnameno longer leak extra results from implementation details.
Incompatible changes
functional.collectusesstd.npairsas a default iterator rather thanstd.ipairs.
Install it with LuaRocks, using:
luarocks install stdlib 41.2.0 [ANN] stdlib 41.1.1 released
stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.
I am embarrassed to announce release 41.1.1 of stdlib.
stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib
Yesterday's release had a infinite loop bug when used with Lua 5.3. This release fixes that bug but is otherwise identical to 41.1.0.
Noteworthy changes in release 41.1.1 (2015-01-31) [stable]
Bug fixes
std.barrelno longer gets stuck in an infinite loop when called in Lua 5.3.
Install it with LuaRocks, using:
luarocks install stdlib 41.1.1 [ANN] stdlib 41.1.0 released
stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.
I am happy to announce release 41.1.0 of stdlib.
stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib
This release overhauls the strbuf class, adds result type checking to the experimental gradual type checking system used throughout stdlib, as well as fixing some bugs. There is also a big backwards incompatibility in the
debug.argscheck syntax, which may affect early adopters, but I decided not to bump the major release number as the API is brand new, and still somewhat in flux. That said, this release is a recommended upgrade for all users.
Noteworthy changes in release 41.1.0 (2015-01-30) [stable]
New features
Anything that responds to
tostringcan be appended to astd.strbuf:locala, b=StrBuf{"foo", "bar" }, StrBuf{"baz", "quux" } a=a..b--> "foobarbazquux"
std.strbufstringifies lazily, so adding tables to a StrBuf object, and then changing the content of them before callingtostringalso changes the contents of the buffer. See LDocs for an example.debug.argscheckaccepts square brackets around final optional parameters, which is distinct to the old way of appending?or|nilin that no spurious "or nil" is reported for type mismatches against a final bracketed argument.debug.argscheckcan also check types of function return values, when specified as:fn=argscheck ("fname (?any...) => int, table or nil, string", fname)
Optional results can be marked with brackets, and an ellipsis following the final type denotes any additional results must match that final type specification. Alternative result type groups are separated by "or".
New
table.unpack (t, [i, [j]])function that defaults j totable.maxn (t), even on luajit which stops before the first nil valued numeric index otherwise.
Deprecations
std.strbuf.tostringhas been deprecated in favour oftostring. Why writestd.strbuf.tostring (sb)orsb:tostring ()when it is more idiomatic to writetostring (sb)?
Bug fixes
std.barreland the variousmonkey_patchfunctions now return their parent module table as documented.- stdlib modules are all
std.strictcompliant; require "std.strict" before requiring other modules no longer raises an error. debug.argscheckcan now diagnose when there are too many arguments, even in the case where the earlier arguments match parameters by skipping bracketed optionals, and the total number of arguments is still less than the absolute maximum allowed if optionals are counted too.package.normalizenow leaves valid ./../../ path prefixes unmolested.
Incompatible changes
debug.argscheckrequires nil parameter type?notation to be prepended to match Specl and TypedLua syntax.?suffixes are a syntax error.debug.argscheckuses...instead of*appended to the final element if all unmatched argument types should match. The trailing*syntax was confusing, because it was easy to misread it as "followed by zero-or-more of this type".
Install it with LuaRocks, using:
luarocks install stdlib 41.1.0 [ANN] stdlib 41.0.0 released
stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.
I am happy to announce release 41.0.0 of stdlib.
stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib
With this release stdlib is moving to semantic versioning. It is a beta release because it constitutes a virtual rewrite, including a fairly substantial reorganisation that makes the libraries clearer and easier to use, but at the cost of drop-in backwards compatibility. In particular, the list module is liable to change radically for better functional programming support in an upcoming release.
Some of the newest features, such as gradual typing at API boundaries, and interfacing with the std.debug module are somewhat half-baked, so you shouldn't use them unless you are happy to rewrite your code for future releases of stdlib.
None-the-less, this is a useful and solid update, and is worth upgrading to now if you plan to transition to future stable releases without the pain of everything changing all at once... especially if you want to support the upcoming Lua 5.3 release.
Noteworthy changes in release 41.0.0 (2015-01-03) [beta]
New features
Preliminary Lua 5.3.0 compatibility.
object.prototypenow reports "file" for open file handles, and "closed file" for closed file handles.New
debug.argerroranddebug.argcheckfunctions that provide Lua equivalents ofluaL_argerrorandluaL_argcheck.New
debug.argscheckfunction for checking all function parameter types with a single function call in the common case.New
debug.exportfunction, which returns a wrapper function for checking all arguments of an inner function against a type list.New
_DEBUG.argcheckfield that disablesdebug.argcheck, and changesdebug.argscheckto return its function argument unwrapped, for production code. Similarly_DEBUG = falsedeactivates these functions in the same way.New
std.operatormodule, with easier to type operator names (conj,deref,diff,disj,eq,neg,neq,prod,quot, andsum), and a functional operator for concatenationconcat; plus new mathematical operatorsmod, andpow; and relational operatorslt,lte,gtandgte.functional.casenow accepts non-callable branch values, which are simply returned as is, and functable values which are called and their return value propagated back to the case caller. Function values behave the same as in previous releases.functional.collect,functional.filter,functional.mapandfunctional.reducenow work with standard multi-return iterators, such asstd.pairs.functional.collectdefaults to usingstd.ipairsas an iterator.New
functional.cond, for evaluating multiple distinct expressions to determine what following value to be the returned.functional.filterandfunctional.mapdefault to usingstd.pairsas an iterator.The init argument to
functional.foldlandfunctional.foldris now optional; when omitted these functions automatically start with the left- or right-most element of the table argument resp.New
functional.callablefunction for unwrapping objects or primitives that can be called as if they were a function.New
functional.lambdafunction for compiling lambda strings:table.sort (t, lambda"|a,b| a<b")
or, equivalently using auto-arguments:
table.sort (t, lambda"= _1 < _2")
New
functional.map_withthat returns a new table with keys matching the argument table, and values made by mapping the supplied function over value tables. This replaces the misplaced, and less powerfullist.map_with.functional.memoizenow propagates multiple return values correctly. This allows memoizing of functions that use thereturn nil, "message"pattern for error message reporting.New
functional.nopfunction, for use where a function is required but no work should be done.New
functional.zip, which in addition to replacing the functionality of deprecatedlist.transposewhen handling lists of lists, correctly zips arbitrary tables of tables, and is orthogonal tofunctional.map. It is also more than twice as fast aslist.transpose, processing with a single pass over the argument table as opposed to the two passes and addition book-keeping required bylist.transposes algorithm.New
functional.zip_with, subsumes functionality of deprecatedlist.zip_with, but also handles arbitrary tables of tables correctly, and is orthogonal tofunctional.map_with.stdmodule now collects stdlib functions that do not really belong in specific type modules: includingstd.assert,std.eval, andstd.tostring. See LDocs for details.New
std.ipairsfunction that ignores__ipairsmetamethod (like Lua 5.1 and Lua 5.3), while always iterating from index 1 through n, where n is the last non-nilvalued integer key. Writing your loops to usestd.ipairsensures your code will behave consistently across supported versions of Lua.All of stdlib's implementation now uses
std.ipairsrather thanipairsinternally.New
std.ielemsandstd.elemsfunctions for iterating sequences analagously tostd.ipairsandstd.pairs, but returning only the value part of each key-value pair visited.New
std.ireversefunction for reversing the proper sequence part of any table.New
std.pairsfunction that respects__pairsmetamethod, even on Lua 5.1.All of stdlib's implementation now uses
std.pairsrather thanpairsinternally. Among other improvements, this makes for a much more elegant imlementation ofstd.object, which also behaves intuitively and consistently when passed tostd.pairs.std.requirenow give a verbose error message when loaded module does not meet version numbers passed.New
std.ripairsfunction for returning index & value pairs in reverse order, starting at the highest non-nil-valued contiguous integer key.New
table.lenfunction for returning the length of a table, much like the core#operation, but respecing__leneven on Lua 5.1.New
table.insertandtable.removethat usetable.lento calculate default pos parameter, as well as diagnosing out of bounds pos parameters consistently on any supported version of Lua.table.insertreturns the modified table.New
table.maxnis available even when Lua compiled without compatibility, but uses the core implementation when possible.New
table.okeysfunction, liketable.keysexcept that the list of keys is returned with numerical keys in order followed by remaining keys in asciibetical order.std.tostring,std.string.prettytostringand the basestd.object__tostringmetamethod now all usetable.okeysto sort keys in the generated stringification of a table.
Deprecations
Deprecated APIs are kept for a minimum of 1 year following the first release that contains the deprecations. With each new release of lua-stdlib, any APIs that have been deprecated for longer than that will most likely be removed entirely. You can prevent that by raising an issue at https://github.com/lua-stdlib/lua-stdlib/issues explaining why any deprecation should be reinstated or at least kept around for more than 1 year.
By default, deprecated APIs will issue a warning to stderr on every call. However, in production code, you can turn off these warnings entirely with any of:
_DEBUG=false_DEBUG={deprecate=false } require"std.debug_init".deprecate=false
Or, to confirm you're not trying to call a deprecated function at runtime, you can prevent deprecated functions from being defined at all with any of:
_DEBUG=true_DEBUG={deprecate=true } require"std.debug_init".deprecate=true
The
_DEBUGglobal must be set before requiring any stdlib modules, but you can adjust the fields in thestd.debug_inittable at any time.functional.evalhas been moved tostd.eval, the old name now gives a deprecation warning.functional.foldhas been renamed tofunctional.reduce, the old name now gives a deprecation warning.functional.ophas been moved to a newstd.operatormodule, the old function names now gives deprecation warnings.list.depairandlist.enpairhave been moved totable.depairandtable.enpair, the old names now give deprecation warnings.list.filterhas been moved tofunctional.filter, the old name now gives a deprecation warning.list.flattenhas been moved totable.flatten, the old name now gives a deprecation warning.list.foldlandlist.foldrhave been replaced by the richerfunctional.foldlandfunctional.foldrrespectively. The old names now give a deprecation warning. Note that List object methodsfoldlandfoldrare not affected.list.index_keyandlist.index_valuehave been deprecated. These functions are not general enough to belong in lua-stdlib, because (among others) they only work correctly with tables that can be inverted without loss of key values. They currently give deprecation warnings.list.mapandlist.map_withhas been deprecated, in favour of the more powerful newfunctional.mapandfunctional.map_withwhich handle tables as well as lists.list.projecthas been deprecated in favour oftable.project, the old name now gives a deprecation warning.list.relemshas been deprecated, in favour of the more idiomaticfunctional.compose (std.ireverse, std.ielems).list.reversehas been deprecated in favour of the more general and more accurately namedstd.ireverse.list.shapehas been deprecated in favour oftable.shape, the old name now gives a deprecation warning.list.transposehas been deprecated in favour offunctional.zip, see above for details.list.zip_withhas been deprecated in favour...