zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Misc. substitution things
Date: Sun, 16 Dec 2007 13:02:54 -0800	[thread overview]
Message-ID: <071216130254.ZM2526@torch.brasslantern.com> (raw)

This seems like a bug:

zsh% print $(( x + "45" ))
dquote> 

It appears that (( and the first double-quote are taken as a matching
pair of quotes.  This is a recently-introduced bug, though I don't know
precisely when; 4.2.6 gives:

schaefer[501] print $(( x + "45" ))
zsh: bad math expression: operand expected at `"45" '

Less importantly, even after 24264 (of which I conceptually approve)
there is some ambiguity with the (P) flag and subscripting.

torch% a=A
torch% b=B
torch% c=C
torch% typeset -R5 x=abc
torch% print $x[3]
a
torch% print ${(P)x[3]}
C

Of course it has never really been "safe" to mix (P) and a subscript
without using a nested substitution to make your meaning clear (most
often one of ${${(@P)x}[3]} or ${(P)${x[3]}}, rarely ${${(P)x}[3]},
because quoting changes the results of that last one).

Post-24264, we're consistent with older zsh on ${(P)x[3]} but not
on ${(P)${x[3]}}.  This might be OK because ${(P)${x[3]}} in the
above example is meaningless in older zsh (because there cannot be a
parameter named "    c").


             reply	other threads:[~2007-12-16 21:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-16 21:02 Bart Schaefer [this message]
2007-12-16 22:16 ` Peter Stephenson

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=071216130254.ZM2526@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).