Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: autoload with explicit path



On Tue, 17 Jan 2017 22:17:54 +0000
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Suppose $^fpath/foo/bar(N) has two matches, how do I explicitly autoload
> the second one?  I.e., how do I disambiguate «autoload foo/bar» (with no
> leading slash) to load a particular copy of foo/bar?

You don't; the mechanism only applies to the last path component so it
will pick the latest version of "bar".

Applying resolution by means of searching along a path is exactly what
the existing $fpath mechanism is for; the new mechanism doesn't replace
that.  It gives you direct access to functions if you know for a fact
you always want the files in a particular directory loaded.  I'm
guessing this will usually apply to people's own private functions, and
it might in principle apply to an add-on that has its own ideas about
paths.  It inevitably won't be a good match for finding / resolving
things that might be anywhere along a path.  But we already have a
mechanism for that.

pws



Messages sorted by: Reverse Date, Date, Thread, Author