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

Re: PATCH: Re: missing -o kshautoload checks

On Aug 1, 10:25am, Sven Wischnowsky wrote:
} Bart Schaefer wrote:
} > ...
} > 
} > I haven't actually tried it, but I'm pretty sure that if you `zcompile -z'
} > a file that ends with `[[ -o kshautoload ]] && $0 "$@"', and you have
} > kshautoload set, you'll end up executing the function *twice* the first
} > time it's autoloaded.
} No, it is *not* executed on the first call. Ok, it is executed, but
} one won't see that because it only redefines itself (and any helper
} functions).

I think you're wrong, but it's because I've tricked you with a typo.

The usual idiom is `[[ -o kshautoload ]] || $0 "$@"', but I wrote `&&'.

With && zsh will execute the function, because kshautoload does *not*
become temporarily unset just because the function is loaded with zsh
semantics.  However, the first execution just harmlessly redefines the
function, so you won't notice.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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