[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANN] std.strict 1.1
- From: "Gary V. Vaughan" <gary@...>
- Date: Sun, 10 Apr 2016 21:59:55 +0100
Enforce strict declaration of all variables (including functions) in any
environment prior to any use or reassignment within that environment.
I am happy to announce release 1.1 of std.strict.
This module started life as `etc/strict.lua` in the Lua 5.0 distribution,
and has shipped for several years in lua-stdlib. I’m still slimming down
lua-stdlib in preparation for the next release, but this release of
std.strict fixes some corner cases when using it with Specl.
### Noteworthy changes in release 1.1 (2016-04-10) [stable]
#### New features
- Strict environments created by this module now correctly proxy `len`
and `pairs` calls to the environment table.
Note that `ipairs` works by looking for the first numeric key with a
`nil` value, and a `nil` valued key in the environment table is the
exact criterion for an undeclared variable access. This means that
passing a strict environment table to `ipairs` always triggers an
"assignment to undeclared variable <#env + 1>" error.
#### Incompatible changes
- To avoid clashing with PUC-Rio strict.lua, rename this package to
std.strict. You should change client packages to load from its new
location:
```lua
local strict = require "std.strict"
```
- To minimise the number of places the release number needs to be
updated, the `std.strict._VERSION` constant has been replaced by a
generated `std.strict.version` submodule.
Install it with LuaRocks using:
```bash
luarocks install std.strict 1.1
```