zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: addition to subscript documentation
@ 2003-05-23 11:39 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2003-05-23 11:39 UTC (permalink / raw)
  To: Zsh hackers list

I just noticed the following useful side effect of the += syntax for
associative arrays.

Index: Doc/Zsh/params.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.17
diff -u -r1.17 params.yo
--- Doc/Zsh/params.yo	29 Oct 2002 10:31:16 -0000	1.17
+++ Doc/Zsh/params.yo	23 May 2003 11:37:48 -0000
@@ -257,6 +257,16 @@
 etc. flags), but it may also affect parameter substitutions that appear
 as part of an arithmetic expression in an ordinary subscript.
 
+It is possible to avoid the use of subscripts in assignments to associative
+array elements by using the syntax:
+
+example(
+   aa+=('key with "*strange*" characters' 'value string')
+)
+
+This adds a new key/value pair if the key is not already present, and
+replaces the value for the existing key if it is.
+
 The basic rule to remember when writing a subscript expression is that all
 text between the opening `tt([)' and the closing `tt(])' is interpreted
 em(as if) it were in double quotes (\

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-23 11:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-23 11:39 PATCH: addition to subscript documentation 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).