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

Re: ksh autoloading



Roderick Schertler wrote:
>One of the nicest things about the ksh semantics are that you can define
>the function plus run some initialization code.  It sounds like your
>patch will disallow that.

Not at all.  Using the zsh style, we can autoload a function foo from
a file saying:

foodate=`date`
foo () {
  echo $foodate
}
foo

whereas the ksh equivalent merely omits that last line.  One could even do

foodate=`date`
foo () {
  echo $foodate
}
[[ -n "${ZSH_VERSION+set}" ]] && foo

to make it work the same under both ksh and zsh.

Remember that the zsh form of autoloading is the canonical one, to be
preferred, and technically superior in some ways to the ksh semantics.
I think it's more important for self-modifying functions using the
zsh style to work correctly than it is for ksh style functions with
initialisation code to work exactly the way they do in ksh.  Not to
mention that the new system is simpler.

-zefram



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