zsh-workers
 help / color / mirror / code / Atom feed
From: Rocky Bernstein <rocky.bernstein@gmail.com>
To: zsh-workers@zsh.org
Subject: zsh -n doesn't grok associate array indexes?
Date: Mon, 10 Jan 2011 12:18:09 -0500	[thread overview]
Message-ID: <AANLkTinS48=Jtes47ryS1aSdX4+o4z3rSO45G6mhSTAg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

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.

             reply	other threads:[~2011-01-10 17:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10 17:18 Rocky Bernstein [this message]
2011-01-10 17:48 ` ZyX
2011-01-10 18:20 ` Peter Stephenson
2011-01-10 19:32   ` Rocky Bernstein

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='AANLkTinS48=Jtes47ryS1aSdX4+o4z3rSO45G6mhSTAg@mail.gmail.com' \
    --to=rocky.bernstein@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).