compgen is a useful builtin for inspecting information about the shell context e.g. in scripts -- a good example of this is compgen -A function or compgen -A variable.
But it's not always available depending on how bash is built, which results in people lacking confidence that it can / should be used in scripts. See e.g. https://bugs.gentoo.org/909148 Would it be possible to have a slightly more minimal version of it with readline functionality and "currently inside programmable completions" functionality stripped out, which just allows it to be used for general environment introspection? An alternative for compgen -A function does exist -- declare -F in combination with e.g. sed. Variables is harder since AFAICT the only way to print all of them prints multiline values too (declare -p is similar to declare -f, there is no declare -P similar to declare -F, using ${!a@} to expand variable names does not work generically enough since you need to specify a prefix -- ${!@} won't expand all of them). -- Eli Schwartz