Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1465483425; bh=99zG7S6XXQIRKoZh7uICKo6F40qFtB6tnVBt8a+CN/w=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=kLzOFLfJz2W4PR4OOTyk3qQAIK5UFSZxcuJFwaq8J2Ytcr0C53wm1k9vuVzfJpRpdK3TnJE35Z7rHffHTtLu55IrU1VnjP78ugA5oZcRKmEFq4QPbyqv5VeeiIXBZuWGUZ/jsMboyHzpWMzwOvur6fc6ZqfmNBelvq/xX6C5pKJ8a1ad44PSiMNpTBXM7rQXgPbR/c7RNcYD3AhOC+fzOORhNWYhdTkWaKbtwwnFFXpq0IYDgW+nv3YEBE2l8hemfgWwnBAr0Ge0/+3ef7nuPkS9q/gRt63oiLEFwVYaxXjcJDnrvBOrYvldTuDXWB1oXhOjCa7XDF0Q6I1aX3r8Yg==
X-Yahoo-Newman-Id: 56493.78302.bm@smtp135.mail.ir2.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: poTrzTEVM1kDWGNWmQObuowDY5GfugHmKpaV71vlGdJCZw_
 TKULHHCjh2unFQtdrLzv9yl2ZR_3DqbIf9u7sGdQp7vJAQs7WWUalfojzjzT
 xFPB_N7tXaRm6wRXFnHmDP3TOiBH3t7yu0t0FNQj7BRcZRAfPegz89ef8PYi
 a6.gTeYM6Sf9B9POML_8dHYvg27uD6O.J9j7Fn9gMpTN85CwLVsR.R2uUiND
 fGNn2BeitkIPmAeH0nN26UG_frVeEZajoAidSVXEq9n.IxppZkBs_y6Rs4QL
 4HoVoU.VPxaGbglT2qKnp6ZnH2TK8KyGX7qhCRsB1Wsr1zzMbLTlQ8J8eYSH
 CmApz3Ml_MV.tzyLpWmJgpXABJ6ln5j7HmlKdpcMP4fuw.pt2BoBJQlHpxfQ
 XI.LySejqy0rw_jPnX1puzoheBSWDgtsLgQIHXqRwbRgLf6Nc6x7BxHHZWTw
 mzJWyCHUqVrIRsg9W5BTvf75hfenG1Dskxi2iIPDOIKdURViS7UQUoXUumc9
 Gg3j66XLaUQeSeV77EPglNcpYn2N1wQ--
X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI-
In-reply-to: <57593D7F.40604@redhat.com>
From: Oliver Kiddle <okiddle@yahoo.co.uk>
References: <57593D7F.40604@redhat.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: When local state_descr is needed?
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <2041.1465483423.1@thecus.kiddle.eu>
Date: Thu, 09 Jun 2016 16:43:44 +0200
Message-ID: <2042.1465483424@thecus.kiddle.eu>
X-Seq: zsh-workers 38640

Marko Myllynen wrote:
>
> It's a bit unclear to me when local state_descr should be declared.
> Reading the man page makes me think that it certainly doesn't hurt to
> do it especially when using the ->string convention but is it in fact
> needed then to avoid any potential or concrete side-effect?

_main_complete declares it local so it mostly isn't needed.

state_descr was added much later so there were many existing functions
that didn't declare it local. Even before, we've often been lax about
declaring opt_args.

I can think of contrived cases where it would be needed. You'd need to
be using it in a state loop where _arguments/_values is also being
called as part of handling a state.

I tend to only declare it in functions that reference it.
I don't think it's really worth patching vast numbers of functions for
it but I wouldn't care either if someone wants to.

Oliver

