"FUNCNAME" might be good to have because it's related to "BASH_SOURCE" in a
similar manner as ".sh.fun" and ".sh.file".

I tried implementing FUNCNAME using the debugger. The trouble is expanding
"${FUNCNAME[@]}". The hack on the last line makes it sort-of work by pushing
new elements on the end during expansion, but then it can't shrink.

function FUNCNAME.get {
    nameref self=${.sh.name}
    if (( .sh.subscript < .sh.level )); then
        trap "(( .sh.level -= .sh.subscript + 1 )); eval '(( .sh.level = 
${.sh.level} ))' \; _=\${.sh.fun}" DEBUG
        trap - DEBUG;
    fi
 
    (( .sh.subscript < .sh.level - 2 )) && self[.sh.subscript + 1]=
}

Still lots of goodies in RELEASE I've yet to play with.
-- 
Dan Douglas
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to