Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zsh -n doesn't grok associate array indexes?
- X-seq: zsh-workers 28615
- From: Rocky Bernstein <rocky.bernstein@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: zsh -n doesn't grok associate array indexes?
- Date: Mon, 10 Jan 2011 12:18:09 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=eUS8RBQ6oyUcYe1u0WlI+JV4wm8t9ioYse/NUDf7Mac=; b=u9kfm3Ey/gcBvAbCkOBczrkN3Yzcaq1aWGXsRZ6SzKjSFVRZ17yqGyPxSbadP3HgxZ HhzPd9KBt98RhRrR9tXaruwsKZKdX56+AUKfyPv6w07q5p+1dJcepiwdi9XBuNg3gMa9 RpakcVXFIy5ier2cYna18LPi/Q27EqrQipUBM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=G0JtVX6ATQ1LRH5CbiWFB0T90aAu3FJtu2MggHAGppb7d4KYwWwcTntkZWFn4ztDk7 7WO3nsXZfZRW7e4W/NMhb8aPwlU1FW8mHskmGocMh+DEIJ+77TUQrPoBkgOAUtgU4WTS 8ZN4DW4csYmhKLt7WbEnnMQKXlKA1qoO4sI4s=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I tried zsh -n to see how good a tool it might be for lint checking. Overall
it works very well.
However I ran into a problem when using a string associative array index.
Here's a sample run:
$ cat /tmp/zsh-bug.sh
> typeset -A hash
> hash['display']=5
> 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)
> $
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- like
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 could
be done about, i.e. legitimate differences between zsh and ksh. However
there were many warnings for performance improvements, removing deprecated
constructs and better ksh conformance.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author