Skip to content

Commit 3016c95

Browse files
committed
refactor: move DEPRECATED, export et.al. from base to debug.
* specs/base_spec.yaml (export, DEPRECATED): Move from here... * specs/debug_spec.yaml (export, DEPRECATED): ...to here. * specs/base_spec.yaml: Remove unused file. * specs/specs.mk (specl_SPECS): Remove specs/base_spec.yaml. * lib/std/base.lua (DEPRECATED, DEPRECATIONMSG, argcheck) (argerror, arglen, argscheck, export, getcompat, setcompat) (toomanyarg_fmt): Move from here... * lib/std/debug.lua (DEPRECATED, DEPRECATIONMSG, argcheck) (argerror, arglen, argscheck, export, getcompat, setcompat) (toomanyarg_fmt): ...to here. Adjust all callers. * lib/std/base.lua (argpairs, checktype, concat, formaterror) (getfenv, getinfo, match, merge, normalize, permutations) (setfenv, whatpath): Move from here... * lib/std/debug.lua (argpairs, checktype, concat, formaterror) (getfenv, getinfo, match, merge, normalize, permutations) (setfenv, whatpath): ...to here, but elide their definitions if _DEBUG.argcheck is false, or equivalent. * NEWS: Update. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
1 parent 5bbdf50 commit 3016c95

File tree

16 files changed

+893
-928
lines changed

16 files changed

+893
-928
lines changed

NEWS

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ Stdlib NEWS - User visible changes
1313
- New `debug.argscheck` function for checking all function parameter
1414
types with a single function call in the common case.
1515

16-
- New `_DEBUG.argcheck` field that disables `debug.argcheck` (and
17-
`debug.argscheck`) for production code. Similarly `_DEBUG = false`
18-
disables those functions too.
16+
- New `debug.export` function, which returns a wrapper function for
17+
checking all arguments of an inner function against a type list.
18+
19+
- New `_DEBUG.argcheck` field that disables `debug.argcheck`,
20+
`debug.argscheck` and changes `debug.export` to return its function
21+
argument unwrapped, for production code. Similarly `_DEBUG = false`
22+
deactivates these functions in the same way.
1923

2024
- New `std.vector` object, for clean and fast queue-like or stack-like
2125
container management. When alien is installed, and element types

lib/std.lua.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ end
244244
-- @table std
245245
-- @field version release version string
246246

247-
local export = base.export
247+
local export = require "std.debug".export
248248

249249
M = {
250250
assert = export "assert (any?, string?, any?*)",

0 commit comments

Comments
 (0)