From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5984 invoked by alias); 10 Jan 2011 17:48:34 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28616 Received: (qmail 9944 invoked from network); 10 Jan 2011 17:48:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=wyvDY0kAoeeMpv24wbK29VplNxqf8IEaTwZy6V7u5Bg=; b=GAq/HHTiC/ny3a+mDLMzej62WvExNRiZaWu/+T2vZgBgGEBW5u/ul4H4cG7+yw93Kd ysCECNNicnb+bYfAKnuBxfOVZ0OzPD/ERlEg01fAxY32vAqAf0bXR2YmgwyUXL6MAmzh tuyqRFTWK5eFJtBtkX1amU0TrPYQg0Z5z/UXU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=djoB8eClJZF4h5atoHi+nOrW8y92NZ9/+KhI3ZMCUnOVtungq8falt7qE7ixMs05BI 9RSHFfWP/s3o/CMfgFt3e24ifcJY4FKfAAWpdGtdP6e13lWoXvajzYY0yqtnadJRoLeu BngDvwhG7BNo+N6HszDVQ8kytyqHViwoRUqi8= From: ZyX Reply-To: zyx.vim@gmail.com To: zsh-workers@zsh.org Subject: Re: zsh -n doesn't grok associate array indexes? Date: Mon, 10 Jan 2011 20:48:19 +0300 User-Agent: KMail/1.13.5 (Linux/2.6.36-zen1; KDE/4.5.4; x86_64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1808925.sPRaKCz6E4"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201101102048.19802@-zyx> --nextPart1808925.sPRaKCz6E4 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Reply to message =C2=ABzsh -n doesn't grok associate array indexes?=C2=BB,= =20 sent 20:18:09 10 January 2011, Monday by Rocky Bernstein: Confirmed: zsh << EOF emulate -LR zsh typeset -A hash hash['display']=3D5 echo ${hash['display']} EOF echoes 5 as expected, but =C2=ABzsh -n=C2=BB echoes the same error. % zsh --version zsh 4.3.10 (x86_64-pc-linux-gnu) By the way, if I replace =C2=AB'display'=C2=BB with =C2=ABdisplay=C2=BB (wh= ich is correct because=20 zsh does not unquote subscripts, you can check it by using =C2=ABecho ${(kv= )hash}=C2=BB) I=20 I get correct value without =C2=AB-n=C2=BB and =C2=ABzsh: hash: assignment = to invalid subscript=20 range=C2=BB with =C2=AB-n=C2=BB. By the way, I can't find description of =C2=ABNO_EXEC=C2=BB option in =C2= =ABman zshoptions=C2=BB. Original message: > I tried zsh -n to see how good a tool it might be for lint checking. > Overall it works very well. >=20 > However I ran into a problem when using a string associative array index. > Here's a sample run: >=20 > $ cat /tmp/zsh-bug.sh >=20 > > typeset -A hash > > hash['display']=3D5 > > echo ${hash['display']} > > $ zsh /tmp/zsh-bug.sh > > 5 > > $ zsh -n /tmp/zsh-bug.sh > > /tmp/zsh-bug.sh:2: bad math expression: operand expected at `'display'' > > /tmp/zsh-bug.sh:3: bad math expression: operand expected at `'display'' > > $ zsh --version > > zsh 4.3.10 (i686-pc-linux-gnu) > > $ >=20 > By the way, I also tried ksh -n from version 93u- 2010-09-22. It also > catches basic syntax errors such as with > complex statements (if, while, case, for) but offers a number of lint- li= ke > suggestions such as to improve speed and and allow for better > ksh conformance. Out of 57 or so files I tried in the zshdb > distribution, there were about 5 errors which I don't think anythingn cou= ld > be done about, i.e. legitimate differences between zsh and ksh. However > there were many warnings for performance improvements, removing deprecat= ed > constructs and better ksh conformance. --nextPart1808925.sPRaKCz6E4 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEABECAAYFAk0rRmMACgkQkOgHluiXxU+7ZACeP5DgG38XvZaG7JDkpwExIu6t 7iUAn3pAUms4xlAaPebbDH1UXZFOSYSz =zu54 -----END PGP SIGNATURE----- --nextPart1808925.sPRaKCz6E4--