This would allow checking if a variable is an indexed array variable using [[ ${array@a} == *a* ]] instead of [[ $(declare -p array) == "declare -a "* ]] which calls a builtin and opens a subshell. Many eclasses use the latter and them being called repeatedly significantly slows down loading of ebuilds.
Alternatively, EAPI 8 or an eclass can provide a common function that eclasses/ebuilds can use. This has already been done in portage itself: if [[ BASH_VERSINFO -gt 4 || (BASH_VERSINFO -eq 4 && BASH_VERSINFO[1] -ge 4) ]] ; then ___is_indexed_array_var() { [[ ${!1@a} == *a* ]] } else ___is_indexed_array_var() { [[ $(declare -p "$1" 2>/dev/null) == 'declare -a'* ]] } fi I still prefer the minimum version upgrade.
This goes further (bash 5) and is already in: https://wiki.gentoo.org/wiki/Future_EAPI/EAPI_8_tentative_features bug #636652
I see. I agree with further upgrading to 5.0 because of mapfile/readarray's -d.
Not only that. It would be simpler to check bash's version. Through `[[ BASH_VERSINFO -ge 5 ]]`.
*** This bug has been marked as a duplicate of bug 636652 ***