zsh-workers
 help / color / mirror / code / Atom feed
* Misc. substitution things
@ 2007-12-16 21:02 Bart Schaefer
  2007-12-16 22:16 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2007-12-16 21:02 UTC (permalink / raw)
  To: zsh-workers

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").


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-16 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-16 21:02 Misc. substitution things Bart Schaefer
2007-12-16 22:16 ` Peter Stephenson

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).