From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 584 invoked from network); 14 Apr 1999 17:28:08 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Apr 1999 17:28:08 -0000 Received: (qmail 10317 invoked by alias); 14 Apr 1999 17:27:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6039 Received: (qmail 10308 invoked from network); 14 Apr 1999 17:27:56 -0000 From: "Bart Schaefer" Message-Id: <990414102751.ZM3847@candle.brasslantern.com> Date: Wed, 14 Apr 1999 10:27:51 -0700 In-Reply-To: <199904120717.JAA26054@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: BUG: zsh-3.1.5-pws-14: parameter expansion not working properly" (Apr 12, 9:17am) References: <199904120717.JAA26054@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@sunsite.auc.dk Subject: Re: BUG: zsh-3.1.5-pws-14: parameter expansion not working properly MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 12, 9:17am, Sven Wischnowsky wrote: } Subject: Re: BUG: zsh-3.1.5-pws-14: parameter expansion not working proper } } The rule of thumb is now that one should use the `(@)' flag whenever } the thing is in double quotes and one wants to work on arrays. When I first saw the patch that introduced that change, I thought that introducing the extra consistency sounded like a good thing. bar=(xa) print -l "${${(@)bar}[1]}" "${(@)${bar}[1]}" Zsh 3.0.5 prints x x But 3.1.5-pws-14 prints x xa which is nice, because you can tell a singleton array from a scalar. Now that I've seen/used it in practice a few times, I'm not so sure any more. The more radical change, and one which bothers me a lot, is the effect when the array has more than one element: foo=(xa yb zc) print -l "${${(@)foo}[1]}" "${(@)${foo}[1]}" Zsh 3.0.5 prints xa x But 3.1.5-pws-14 prints x xa That's completely reversed the semantics, and thus is a serious problem. Another difficulty is that (@) has to be repeated at *every* level of a nested expansion, from the innermost ${...} at which an array is desired all the way to the outermost braces. "${${${${(@)foo}}}}" == "$foo[@]" To get the equivalent effect now, having to write "${(@)${(@)${(@)${(@)foo}}}}" == "$foo[@]" is error-prone and just plain annoying. There must be a better way. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com