zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Cc: Nikolai Weibull <zsh-users-list@pcppopper.org>
Subject: Re: Associative Arrays
Date: Fri, 22 Oct 2004 08:07:13 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0410220803040.23496@toltec.zanshin.com> (raw)
In-Reply-To: <20041022123233.GF1720@frhdtmp102861.morse.corp.wan>

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.


  reply	other threads:[~2004-10-23 16:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-20 19:53 Nikolai Weibull
2004-10-21 11:05 ` Stephane Chazelas
2004-10-21 12:38   ` Nikolai Weibull
2004-10-21 16:40     ` Bart Schaefer
2004-10-21 20:22       ` Nikolai Weibull
2004-10-22 12:32       ` Stephane Chazelas
2004-10-22 15:07         ` Bart Schaefer [this message]
2004-10-25 13:14           ` Stephane Chazelas
2004-10-21 23:22     ` Eric Mangold
2004-10-22  0:08       ` Nikolai Weibull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0410220803040.23496@toltec.zanshin.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users-list@pcppopper.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).