From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24687 invoked from network); 23 Oct 2004 16:08:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Oct 2004 16:08:53 -0000 Received: (qmail 93351 invoked from network); 22 Oct 2004 15:08:47 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 Oct 2004 15:08:47 -0000 Received: (qmail 4459 invoked by alias); 22 Oct 2004 15:08:04 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8094 Received: (qmail 4443 invoked from network); 22 Oct 2004 15:08:02 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 22 Oct 2004 15:08:02 -0000 Received: (qmail 91604 invoked from network); 22 Oct 2004 15:07:19 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 22 Oct 2004 15:07:18 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id i9MF7DMS002273; Fri, 22 Oct 2004 08:07:13 -0700 Date: Fri, 22 Oct 2004 08:07:13 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk cc: Nikolai Weibull Subject: Re: Associative Arrays In-Reply-To: <20041022123233.GF1720@frhdtmp102861.morse.corp.wan> Message-ID: References: <20041020195348.GJ11322@puritan.pcp.ath.cx> <20041021110526.GE1740@frhdtmp102861.morse.corp.wan> <20041021123835.GF9224@puritan.pcp.ath.cx> <20041022123233.GF1720@frhdtmp102861.morse.corp.wan> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 On Fri, 22 Oct 2004, Stephane Chazelas wrote: > On Thu, Oct 21, 2004 at 09:40:14AM -0700, Bart Schaefer wrote: > [...] > > local -A named; set -A named "$@" > [...] > > That's not correct as "$@" may have "-x"/"-e" like elements. You'd be right if we weren't talking about zsh. From the doc for "set": The behaviour of arguments after -A NAME or +A NAME depends on whether the option KSH_ARRAYS is set. If it is not set, all arguments following NAME are treated as values for the array, regardless of their form. If the option is set, normal option processing continues at that point; only regular arguments are treated as values for the array. This means that set -A array -x -- foo sets array to `-x - foo' if KSH_ARRAYS is not set, but sets the array to foo and turns on the option `-x' if it is set. > ksh has: > > set -A named -- "$@" > > it doesn't seem to work in zsh 4.2.0. See above. > named=("$@") > > is OK though. I'll agree it's better because it doesn't vary with KSH_ARRAYS.