From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11306 invoked by alias); 2 Jan 2013 08:32:56 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17525 Received: (qmail 3920 invoked from network); 2 Jan 2013 08:32:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at linux.vnet.ibm.com does not designate permitted sender hosts) Date: Wed, 2 Jan 2013 16:32:24 +0800 From: Han Pingtian To: zsh-users@zsh.org Subject: Re: PATCH and more remarks on parameter expansion docs Message-ID: <20130102083224.GF2054@localhost.localdomain> References: <121230112044.ZM879@torch.brasslantern.com> <20121231233002.GC2054@localhost.localdomain> <130101211501.ZM3814@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <130101211501.ZM3814@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13010208-7182-0000-0000-000004247BA7 On Tue, Jan 01, 2013 at 09:15:01PM -0800, Bart Schaefer wrote: > On Dec 27, 3:08pm, Han Pingtian wrote: > } Subject: Re: splitting in assignment forms of expansion > } > } I think we should say something like this about this feature in the man > } page: > } > } Note during assignments with the A flag, that splitting is applied > } to word in the assignment forms of spec before the assignment to > } name is performed. This will affects the result. > > I added something similar in the patch. Thanks your nice patch. But I'm still wondering why not change the statements after "${=spec}" in man page. Or I'm misunderstanding the original statements which has been stating this "splitting before assignment" behavior is only related to "(A)" flag? > > > The (t) flag is an oddball. If combined with (P) [rule 4], it takes > effect after that name replacement. However, if *not* combined with > (P), then it takes effect *before* subscripting [rule 3]. Thus: > > % x=path > % print ${(t)x} > scalar > % print ${x[2,4]} > ath > % print ${(t)x[2,4]} > cal > % print ${(tP)x} > array-unique-special > > I might have expected ${(t)x[2,4]} to print the type of the variable > named "ath", but that isn't what happens. So I haven't attempted to > work it into the rules, but it's a perfect example of how parameter > expansion syntax lacks well-defined precedence. Yep, it looks like there are quite some special cases.