Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: mixed [key]=val and native syntax
- X-seq: zsh-workers 41755
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: mixed [key]=val and native syntax
- Date: Sun, 24 Sep 2017 17:20:37 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=JezB9I Gxc+O6Z6bRzX4VI9P6rcOMh7YE0s60rLA+ILc=; b=h6q/9F3GQhFFPWblcdX564 wxef5LyVg6pH87NALFR0kWd45t39UOC9IyNINEPQCFYjQGt+X6JVIbxo5hyNewHZ es8F+BrVOCa5hBZN51LFk2+6x8QPKaTZQzfNpzn00O61H6lbaNWSo4wthLlSPbcF EArUES6vExt8sLKBUkZQUc2OoBdxRZOCVaVxp5DhL7zRny1rRQMcuKo2Mpc/bzZr SJb5yIfRow4tun1CQXwIu5Ps/bVrAGX87qbnIGuQsvpUCNDOtTpJsqfTAlm1R5jA Yz4MxvepqvAcPvfb6FG5Bi5z/WasPjUcsGQp+1hWwhyPOEgggbCbiUALU5PyPByg ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=JezB9I Gxc+O6Z6bRzX4VI9P6rcOMh7YE0s60rLA+ILc=; b=OZGftnkaqcRlJvMDLm/WWu 4e1KrwcSueuPDlwlge8EbBiubpoyh+LiQpS4MIyXehlPmwhfzBjMWHThm75VvoDa 1iPmV+ZiJj3PpF63Mf4hOc1oMllv3XoKDlSRoAEtfA/GY4Yw9SHhDxnK20ib+UoQ P+48hRYR9mOamv/z1Zbmj7z4GJ5JgV6zHB32hGRDTZW5JoQmPTumdJZQB87943cS 9ADQxgAege7ltoBoo4YSzVVyJVSBJ68J178a7Nyl66er7GxEZwt3tz+1jqUahO4g aDKsdcKhJyZG4prNABi2xNjQxFwoqi3235PleBTTX85RCmehhJiMcsHvt8R0/m8Q ==
- In-reply-to: <20170924172605.12a2ee67@ntlworld.com>
- 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
- References: <20170923214252.54660857@ntlworld.com> <20170924172605.12a2ee67@ntlworld.com>
Peter Stephenson wrote on Sun, 24 Sep 2017 17:26 +0100:
> +++ b/Doc/Zsh/params.yo
> @@ -109,10 +109,19 @@ of subscript expression that may be used when directly subscripting a
> variable name, described in the section Array Subscripts below, are not
> available.
>
> -When assigning with this third form, every element must use this syntax or
> -an error is generated. Likewise, if the first entry does not match this
> -form, any later entry that does is taken as a simple value rather than a
> -key / value pair. Both var(key) and var(value) undergo all forms of expansion
> +The syntaxes with and without the explicit key may be mixed. Any absent
> +var(key) is deduced by incrementing the index from the previously
> +assigned element. Note that it is not treated as an error
> +if latter assignements in this form overwrite earlier assignments.
"Any absent var(key)" sounds like it describes empty square brackets followed
by an equals sign.
-Any absent var(key) is...
-An implicit var(key) is...
> @@ -159,6 +168,10 @@ indent(tt(set -A) var(name) var(key) var(value) ...)
> indent(var(name)tt(=LPAR())var(key) var(value) ...tt(RPAR()))
> indent(var(name)tt(=LPAR())tt([)var(key)tt(]=)var(value) ...tt(RPAR()))
>
> +Note that only one of the two syntaxes above may be used in any
> +given assignment; the forms may not be mixed. This is unlike the case
> +of numerically indexed arrays.
For assocs would it make sense to allow mixing, but not between key and value, e.g.,
typeset -A a=( k v [k2]=v2 k3 v3 )
but not
typeset -A a=( k [k2]=v2 v )
?
>
P.S. An out-of-tree 'make' generates Doc/*.1 in the source tree, rather than in
the build tree.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author