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

Re: real time alias?

On Mar 16, 11:56am, Ray Andrews wrote:
} I get it.  The function can't 'grab' a new version of the alias without 
} recompiling itself which ends up being far more trouble than it's 
} worth.  Mind, my functions do know where they came from:
}      (1)TYPE: c is a shell function from /aWorking/Zsh/Source/c:

Sure, but it doesn't keep track of whether "c" is the ONLY function
that came from that file.  It wouldn't be safe to automatically re-
source just any such file.  Telling zsh which files can be sourced
that way is the job of "autoload".

It would be possible for every function to know whether it originally
came in via "autoload" and have some criteria for whether to discard
the current definition and re-load again.  However, given the possible
chain of dependencies (this alias depends on that function depends on
some other alias depends on ...) it isn't practical to keep track of
everything that might have gone into the definition of a function.

Besides, we generally recommend NOT depending on aliases in autoloaded
functions, and therefore using "autoload -U ...".

Maybe this is a feature that Sebastian is interested in tackling in his
plugin manager:  Remembering functions that are autoloaded *without* -U
in plugins that define aliases, and reloading them if the aliases are
updated.  Although it does seem ripe for unintended side-effects.

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