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

Re: PATH: autoload with explicit path



On Sun, Jan 29, 2017, at 08:11 AM, Bart Schaefer wrote:
> On Sun, 29 Jan 2017, Sebastian Gniazdowski wrote:
> 
> > To make the new feature complete, absolute paths must descent to
> > autoloaded functions. Keeping the absolute path only to directly
> > autoloaded function is ersatz. It's a half-step. I autoload single
> > function, and then FPATH again takes control and does the "imagine the
> > layers" thing. This is a tragedy.
> 
> Respectfully, Sebastian, I disagree.
> 
> Consider for example that several of the autoloadable functions in the
> zsh distribution rely on "autoload colors".
> 
> If autoload behaved the way you suggest, this would break, because the
> colors function would not be found at the absolute path from which the
> calling function was loaded -- unless the writer of the calling function
> has used "autoload -d", of course. 

I wrote earlier that -P (let's use your proposed option name) should
prepend dirchache path to FPATH. In other words, -P causes any descent
autoload to try dircache part first, then follow to process fpath.

> But if we're now relying on the
> author to use the correct options for autoload, we're right back where
> we started -- might as well rely on the author to make his function
> suite "relocatable" by way of $function_source as well, and that is
> now possible.
> 
> There's no magic solution that automatically covers all the variations
> without cooperation from both the writer and the installer of the suite.

I think -P is a complete idea, as you know it comes from problems with
Zplugin, -P would solve those problems. So the idea has some real world
experience to back it up.

-- 
  Sebastian Gniazdowski



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