From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6684 invoked by alias); 24 May 2017 12:21:02 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41144 Received: (qmail 12205 invoked from network); 24 May 2017 12:21:02 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f51.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.51):SA:0(0.5/5.0):. Processed in 1.237407 secs); 24 May 2017 12:21:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM, SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.82.51 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=hIov9eCt6EHayqK+b6AUIyUONkD7YXwLTMVzDoeQK7Q=; b=pydIGOCAzhp1TpV/lkyl5q8DtnIrAZ5q83Fx9egGiBxbJ/n+8eFAvxZ+k/ulPTIEYJ RzOsou2StVOM1YeWjSzCDrMfHnsY4VzHL64oH7d9FqdIZg2X8p55JIDMa4JkEZhJ3VVU +hsQs91lPrlv/O6RhK2VQpHzFzDUnCfK2MDU8jEnAL73L8UB8GHwU589w/ZVpUJoejXC /X8PfIek6wU3FCo2S9iq15u0ga240/sAgZvV8KWbt7dYC6NogYK7GSZh3pKECiaHc7Gk Oe0e0VebvYsu4dRrRnWMW2pTC10vHatH2cNgowTEd79fkl5d5EM/pxf9CO00ILmcQVU+ e2Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:user-agent; bh=hIov9eCt6EHayqK+b6AUIyUONkD7YXwLTMVzDoeQK7Q=; b=tuG7WIa2k7hz/WtbP34iNI0ZBbW5wzn+C7dSxfyTURO/qj4lhPTaBXdXlnFFQv98FD PccqB94lwjq6dAVYN/IidTNCtYqLDvJpwGjpDRrumx5SpFUvRkzFqPIX5NNuz5Dx4KdH xWFE4q/yVTOnM41DdBRYf/DDJCEG7i2pgE7fOL68Om522WhKplm/UE7bEsJUXdqE0PFr 6WLNPzhQA0s4OQTNO3Abeowl+jheb6G7TQHhYBByxfug0g9XzZGZwusF4uS0P2OYwQNl wIyeczgivNcEHBqqFX0e5MuzMwPhEd0Itmqrb4ya2NvWM2bkVR54eDXRUpcIbGSN+6xL F9SA== X-Gm-Message-State: AODbwcDNDHm4lowqHhO+7dkywliqpivCRBRgYfNd4Q5I05K17iUv1rLm 6AEbyRN214CTzexN X-Received: by 10.223.163.80 with SMTP id d16mr23495287wrb.164.1495628452913; Wed, 24 May 2017 05:20:52 -0700 (PDT) Date: Wed, 24 May 2017 13:20:49 +0100 From: Stephane Chazelas To: Zsh hackers list Subject: [PATCH] [DOC] typeset -LRZul don't apply to (associative) arrays Message-ID: <20170524122049.GB3861@chaz.gmail.com> Mail-Followup-To: Zsh hackers list MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline typeset -u (for uppercase) and others like -LRZul don't apply to (associative) arrays: $ typeset -au a $ a=(a) $ echo $a a Just as well IMO as it would cause confusion with -U, or worse for the keys of associative arrays. People can (and probably should always instead of using those ksh-style flags) use parameter-expansion-flags instead (${(U)array}...). Other option is to go the ksh93 way: $ ksh93 -c 'typeset -a -u -R3 a; a=(a b); printf "<%s>\n" "${a[@]}"' < A> < B> $ ksh93 -c 'typeset -A -u a; a=([a]=x [A]=y); for k in "${!a[@]}"; do printf "%s => %s\n" "$k" "${a[$k]}"; done' A => Y a => X (for associative arrays, only the values are transformed, though for elements whose values are arrays, that doesn't apply to the values of those arrays: $ ksh93 -c 'typeset -A -u a; a=([a]=x [b]=(n m)); echo "${a[a]}" "${a[b][0]}"' X n ). Doc patch attached for the current situation. I'd say it's probably not worth mentioning that in the case of arrays tied to scalars (typeset -T), only the expansion of the scalar one is affected. -- Stephane --6TrnltStXW4iwmi0 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="typeset-doc.diff" diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 81687c7..0e26da3 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -2012,7 +2012,8 @@ enditem() Attribute flags that transform the final value (tt(-L), tt(-R), tt(-Z), tt(-l), tt(-u)) are only applied to the expanded value at the point of a parameter expansion expression using `tt($)'. They are not applied -when a parameter is retrieved internally by the shell for any purpose. +when a parameter is retrieved internally by the shell for any purpose. +They have no effect on array or associative array parameters. The following attribute flags may be specified: --6TrnltStXW4iwmi0--