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,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;
        h=from:message-id:date:in-reply-to:comments:references:to:subject
         :mime-version;
        bh=9Uxb4M9829JARtmEhWuVr36L2WQ4uPIZECCDPVZ2ogo=;
        b=Dgmn336FZiJQb7WCvviyd7xJ5xHHsRc5jPhd7ruxyy+KYewtXelmlVZ9CrKiW/wlI3
         Yl9U9G7kgMwdkfoTANFFC0z0QdAOfG7Ye/Fqa3Uo5goMRdvlKsRnYGR59DGyUp66am/6
         GnXONxggYUQ3CL+ICLM3iRjTx2wwfy5CFUbw6GFIOsdVtNynbeVOlTwpOaRtxZNKculu
         0dnu13bSUMQpPxk4ZxanQTNHHKNQi1PL3CbDgPg5vcHyODKb9wLtWmuGElKCgpxQlk7a
         oirn2c1YwbbDEDrqUEpjOIZhe/OT5juohHXvAXzD9IyXmnWnbr07t5LOFHjPf/XqxyOv
         ky3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:date:in-reply-to:comments
         :references:to:subject:mime-version;
        bh=9Uxb4M9829JARtmEhWuVr36L2WQ4uPIZECCDPVZ2ogo=;
        b=RFIfKLutbQlBMF5/k3sqALCxPrWdRd3c4JMvqIztEuzjzIMEwjcXoFShq8PnZWwO3p
         27/2FlWPi7F4ujHFAD12zvinO7/DBM2kpd08a6Eh3Btgn3MTLmDDonv75wjfjuwzzOkT
         HqF5MRjr++x+CHl1P/2SggeLbo4mGgfVjVWphgWnqBx7F2dFUevv2NfeXEALcu8bAHUm
         vWOLjIQPgG6e8bt1URykOwS+ZqLFS3LXqmd8tOehnz+8gfE6BHhJw3vQG8FG8DgZK4yL
         79v+6mGmnUvgHoOl2f02nqv8QLRRxjaSdmOgAiKew67A9BYprNHh9T6vLF2VPHToFFys
         ayvA==
X-Gm-Message-State: AD7BkJKNXBSs1vLb7WrJmJm01RDYr4L/7vIMiPyBkK4Q4mP2mt8zvhURgo/suQ2DFgCsLg==
X-Received: by 10.66.253.68 with SMTP id zy4mr8870079pac.81.1458785274117;
        Wed, 23 Mar 2016 19:07:54 -0700 (PDT)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160323190830.ZM2502@torch.brasslantern.com>
Date: Wed, 23 Mar 2016 19:08:30 -0700
In-Reply-To: <20160323092338.492731f9@pwslap01u.europe.root.pri>
Comments: In reply to Peter Stephenson <p.stephenson@samsung.com>
        "Re: zsh -n does not detect incorrect associative array declaration" (Mar 23,  9:23am)
References: <56F1C3D7.6020800@redhat.com> 
	<CAH+w=7YDbbw_J2G6BJKqi9=MtymqAQo1Zhv-19FGK0RqFnyScA@mail.gmail.com> 
	<56F1FF5F.6060907@redhat.com> 
	<CAH+w=7bkphoEdbFzXbU4_UXNWjr8M1UMUuO0QAiOfh=QR--1Ww@mail.gmail.com> 
	<20160323092338.492731f9@pwslap01u.europe.root.pri>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: zsh -n does not detect incorrect associative array declaration
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 38213

On Mar 23,  9:23am, Peter Stephenson wrote:
} Subject: Re: zsh -n does not detect incorrect associative array declaratio
}
} On Tue, 22 Mar 2016 23:40:54 -0700
} Bart Schaefer <schaefer@brasslantern.com> wrote:
} > Contrast this with ksh where associative array assignments look like
} > 
} > fn=( [foo_key]=foo_val [bar_key]= )
} > 
} > forcibly changes the type of "fn" to become an associative array
} 
} Off the original topic, but actually it doesn't, at least not in bash.

I'd forgotten that bash even supports that syntax, but in any case it
does change the type in ksh.

$ typeset -a x
$ typeset -p x
typeset -a x
$ x=( [a]=1 [b]=2 )
$ typeset -p x
typeset -A x=([a]=1 [b]=2)
$ 

Bash allows you to set numerically-indexed positions in a normal array
with the ( [key]=value ) syntax, and also outputs the arrays that way
with "typeset -p".  You can have sparse arrays in bash.

