Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Glitch with "eval" and "autoload"
- X-seq: zsh-workers 37745
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Glitch with "eval" and "autoload"
- Date: Sat, 23 Jan 2016 10:03:11 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version:content-type; bh=446wg6qQlO5jozYfj6bY8aK1ekCGIMyPYcLfoA1epKs=; b=P0OCqRz1beB4nAeEefD/kLk3MX34sKBCWosvLg03eFQ5M7G7yjwiPFZm/6OK5PTS6S Fb0RdJaqV9JiM8+ZRbOeCMPYWAf2xNHsdBkpC5jMsYM+xRHG7/WvxqJ1nZ3TajGy4Zof bJhUWOH+EysiuPT8oh9CoTtNlqFWpDtSr7V0G++eOFBI2m9nLupITqO1fx8YsB7ISN/M 0CmzMC21kOe2xEJGUmDwa846EoGzf1e5JrPCnSh3gOdFMTUhijCL0nTSjCcnjkgwUtjP 0DooGxGpXTp24ZCHqyt28B1dIKixiGYe1Ii+UEAC5zQf70v7IfsNNrZJpWc4aAvPRpET VK2Q==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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".
Messages sorted by:
Reverse Date,
Date,
Thread,
Author