If you put this in an executable file in your PATH, it'll be a script. I recommend doing that. You can also create a function with that body but that would be worse.I don't call this function directly, it is only called from an aliasAliases can invoke scripts just as easily as they can invoke functions. Roman.
So to sum up, it sounds like your advice is "Always use a script instead of a function. If the script can't work for whatever reason, then use a function."
I will do this.To keep things organized, I think I set up a subdirectory called ~/bin/shell_alias_scripts, add it to $PATH and toss all the scripts that are used by aliases in there. And so long as I only call these scripts with an alias, there shouldn't be any performance penalty because they won't all have to be sourced by zsh.
Thanks!