maint: The Grand Renaming II™ - use `require "std.string"` etc.

Now that individual modules are loaded from the std subdirectory,
remove the spurious "_ext" suffix so that `require "std.io_ext"`
is not needed any more.
* lib/std/debug_ext.lua, specs/debug_ext_spec.yaml,
lib/std/io_ext.lua, specs/io_ext_spec.yaml,
lib/std/math_ext.lua, specs/math_ext_spec.yaml,
lib/std/package_ext.lua, specs/package_ext_spec.yaml,
lib/std/string_ext.lua, specs/string_ext_spec.yaml,
lib/std/table_ext.lua, specs/table_ext_spec.yaml: Rename from
these...
* lib/std/debug.lua, specs/debug_spec.yaml, lib/std/io.lua,
specs/io_spec.yaml, lib/std/math.lua, specs/math_spec.yaml,
lib/std/package.lua, specs/package_spec.yaml, lib/std/string.lua,
specs/string_spec.yaml, lib/std/table.lua, specs/table_spec.yaml:
...to these. Adjust all require calls.
* specs/io_spec.yaml, specs/string_spec.yaml, specs/table_spec.yaml
(extensions): Add some missing apis.
* lib/std.lua.in, lib/std/modules.lua: Adjust and simplify.
* specs/specs.mk (specl_SPECS): Adjust.
* local.mk (dist_luastd_DATA): Adjust.
* NEWS: Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
object: __totable and __index support.

Provide object.type, analagously to io.type.
* specs/object_spec.yaml (__totable): Specify desired
behaviour.
* specs/set_spec.yaml (__totable): Likewise.
* specs/strbuf_spec.yaml (__totable): Likewise.
* lib/std/object.lua (typeof): Rename from this...
(M.type): ...to this, to support e.g. object:type ().
(new.__totable): Return a table of non `_` prefixed object
elements.
(new.__index): Defer to methods in M, when the object itself has
none.
* lib/std/getopt.lua (argtype): Set of valid argtype keys.
(getopt): Comparing an Option's type field to nil doesn't work,
because of the Object:type () method it shadows.  Instead check
for a value not in the argtype set.
(usageinfo): Reorder type tests to avoid the same Object:type()
problem.
* lib/std/set.lua: Use object.type instead of object.typeof.
* specs/object_spec.yaml, specs/set_spec.yaml,
specs/strbuf_spec.yaml: Adjust.
* NEWS: Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
string: display prettyprinted table keys in table.sort order.

When comparing actual and expected output in unit tests, or with
Specl matchers, it's quite difficult to write robust examples when
the output of prettyprint is randomised for tables.  This commit
ensures that table keys are always output in the same order.
* specs/string_spec.yaml (prettytostring): Examples of desired
behaviour for string.prettytostring.
* lib/std/string.lua (render): Use a sorted list of keys to
determine the order in which they are output.
* NEWS: Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
string: prettyprint valid symbol keys without spurious quoting.

* specs/string_spec.yaml (prettytostring): Remove quoting from
examples with valid symbols as keys.  Add an example with some
invalid symbol names as table keys.
* lib/std/string.lua (prettytostring): Skip the key quoting
code unless a key is not a string, or contains any non-word
character.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
configury: specl 8 required for stdlib compatible objects.

* configure.ac (SPECL_MIN): Bump to Specl 8. Earlier versions use
an incompatible object system, which crash when fed recently
enhanced stdlib objects.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
object: respond to tostring() with stringified table of non-hidden fields.

Rather than add individual __tostring metamethods to every object
type, implement a general stringification algorithm in the base
object, to return the type followed by the array part of the object,
and then the dictionary part of the object.
* specs/object_spec.yaml (__tostring): Describe desired behaviour.
* specs/set_spec.yaml (__tostring): Likewise.
* lib/std/object.lua: Don't overwrite core table functions with
std.base. Adjust all callers.
(new.__tostring): return stringification of non-hidden fields.
* lib/std/set.lua (new.__tostring): Remove. Inheritted base object
metamethod is equivalent.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
object: be sure to run tostring on array elements before table.concat.

* lib/std/object.lua (new.__tostring): table.concat requires that
all elements already be strings, so call tostring on the array
part of the object table before passing to table.concat.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
list: derive from `std.object`.

* specs/list_spec.yaml: Describe expected behaviour of list as an
Object.
* specs/specs.mk (specl_SPECS): Add specs/list_spec.yaml.
* lib/std/list.lua (metalist): __lt and __le metamethods only
work if both objects share the same metatable... this one for
list objects.
(new): Return a new Object, with metalist as the metatable,
and _clone doctored to propagate the metalist metatable.
(M): Return a callable table that forwards module calls to the
`new` function.
* NEWS: Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>