Subject: Re: [PATCH] completion: move private shopt shim for zsh to __git_ namespace

From: Jonathan Nieder <[email-masked]>
Date: Wed, 27 Apr 2011 18:00:08 -0500

Felipe Contreras wrote:

> I have been looking for a way to have local aliases or functions, but
> I can't find any.

It is possible to do

	if [[ -n ${ZSH_VERSION-} ]]; then
		alias __git_local="typeset -h"
	else
		alias __git_local=local
	fi

but let's consider that for a moment.

 1. It's ugly (it means completion code would use a dialect where the
    ordinary "local" keyword has to be spelled differently).

 2. It's ugly (use of aliases in scripts sets off alarm bells.  As
    Almquist's sh manual says:

	Aliases provide a convenient way for naïve users to create
	shorthands for commands without having to learn how to create
	functions with arguments.  They can also be used to create
	lexically obscure code.  This use is discouraged.)

 3. It's fragile (maybe some day a function from zsh's completion
    library that we call will look at $words and get utterly confused).

I don't mean to sound so negative; actually I am very happy to see us
getting closer to a full understanding of the problem and relevant
constraints.