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

autoloaded function behaviour

There is a problem with the present function autoloading scheme.  It is not
a big problem, it just seems that it is too ksh compatible.

As you all know zsh originally assumed that in the file it loads only the
function body is stored while ksh simply executes the file in the current
shell environment then executes the required function.

To hack in ksh compatibility zsh first assumes that the file is the body of
the function and executes this as a function.  If the executed function is
redefined during that process then it is executed again.  This means that
if a zsh function uses the old zsh way for autoloading and it redefines
itself, the redefined function will be executed after the real function
exits.  The only way to prevent this is by using ksh-style autoloding.  In
that case there is no way to be compatible with both the original zsh and
the ksh behaviour.

This can be left as it is saying that it is a rare case with a workaround
and actually I prefer.  The only other solution I see now is to add a new
option which forces the original zsh behaviour.


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