Subject: Glitch with "eval" and "autoload"
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Date: Sat, 23 Jan 2016 10:03:11 -0800
List-Id: Zsh Workers List <zsh-workers.zsh.org>

torch% oops() { eval autoload -X }
torch% oops 
(eval):1: parse error near `"$@"'
torch% functions
'(eval)' () {
        # undefined
        builtin autoload -X
}
oops () {
        eval autoload -X
}

This happens because bin_typeset() gets the name to be autoloaded from
the "scriptname" global, which at the time autoload was invented was not
modified during intervening "eval" and other internal scopes.

The ancient behavior is restored if the "eval_line_no" option is unset.

What's the right way to get the actual function name?  Climbing up the
fstack looking for strcmp(fsptr->name, "(eval)") != 0 seems pretty ugly,
but the "ineval" global isn't sufficient for e.g. "eval eval autoload -X".