From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3961 invoked by alias); 13 Feb 2014 16:56:37 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18441 Received: (qmail 26234 invoked from network); 13 Feb 2014 16:56:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140213085618.ZM26934@torch.brasslantern.com> Date: Thu, 13 Feb 2014 08:56:18 -0800 In-reply-to: Comments: In reply to Sebastian Stark "zparseopts default associative array" (Feb 13, 8:17am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: zparseopts default associative array MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 13, 8:17am, Sebastian Stark wrote: } } Maybe I misunderstood something, but isn't my example the intended use } of -K? Or is the condition "when none of the specs for them is used" } really meant like "if one option is given, all other default values } are emptied"? How would this make sense? Yes, it really does mean that the defaults are kept only if NONE of the possible options for the array are parsed. Although it applies to the default arrays, the intended usage is really with the =array form as in this snippet of Completion/Base/Core/_description: gropt=(-J) xopt=(-X) nopt=() zparseopts -K -D -a nopt 1 2 V=gropt J=gropt x=xopt In this example -V and -J are mutually exclusive. (There seem to be a number of unnecessary uses of -K in the Completion tree.) Before the introduction of -K, gropt and xopt would have been unconditionally erased by having merely been mentioned in the zparsopts arguments. Yes, it would probably make sense for associative arrays if -K retained individual elements for associative arrays, but the implementation does the equivalent of the whole-array assignment o=(-a foo) for both plain and associative arrays because there is no useful way to do individual element assignment in the non-associative case. Unfortunately -K was an afterthought added with the minimal possible code changes.