Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: order of sourcing
- X-seq: zsh-users 28649
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: Ray Andrews <rayandrews@xxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: order of sourcing
- Date: Tue, 17 Jan 2023 13:34:45 -0800
- Archived-at: <https://zsh.org/users/28649>
- In-reply-to: <CAN=4vMqV+uxJXBLoOYGicAXjB07yv7mwrUS26hG34J0PnUNK_w@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <bb9bb69a-8608-ec18-d340-740fc813eec3@eastlink.ca> <CAN=4vMqV+uxJXBLoOYGicAXjB07yv7mwrUS26hG34J0PnUNK_w@mail.gmail.com>
On Tue, Jan 17, 2023 at 1:24 PM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> The standard solution is to autoload functions. It solves a bunch of
> other problems that you get when sourcing files with function
> definitions
One complication here is that, if Ray is able to use "source" to load
a function's definition, then he's not writing the file in the
ordinary autoload format -- that is, the file must in fact contain the
full
funcname() {
# funcbody
}
whereas an autoload would normally be a file named "funcname"
containing only the function body. To make autoloading work with
files designed to be sourced, one must employ additional tricks, such
as using "autoload -k". Also, this remark --
> > run into 'not found' issues, like some subsidiary function has been
> > 'lost'.
-- also makes me suspect that Ray has more than one function per file,
which further messes with autoload.
> - You can rely on there being no aliases when the function is parsed.
That needs "autoload -U" I think?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author