From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25993 invoked from network); 18 Mar 2008 15:48:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 Mar 2008 15:48:00 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 49104 invoked from network); 18 Mar 2008 15:47:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Mar 2008 15:47:51 -0000 Received: (qmail 4121 invoked by alias); 18 Mar 2008 15:47:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24724 Received: (qmail 4108 invoked from network); 18 Mar 2008 15:47:46 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 18 Mar 2008 15:47:46 -0000 Received: from vms173001pub.verizon.net (vms173001pub.verizon.net [206.46.173.1]) by bifrost.dotsrc.org (Postfix) with ESMTP id 582BD8097826 for ; Tue, 18 Mar 2008 16:47:42 +0100 (CET) Received: from torch.brasslantern.com ([71.116.105.150]) by vms173001.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JXX00FHRNC4I3D5@vms173001.mailsrvcs.net> for zsh-workers@sunsite.dk; Tue, 18 Mar 2008 10:36:06 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id m2IFlSpO012525 for ; Tue, 18 Mar 2008 08:47:29 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m2IFlS5Y012524 for zsh-workers@sunsite.dk; Tue, 18 Mar 2008 08:47:28 -0700 Date: Tue, 18 Mar 2008 08:47:28 -0700 From: Bart Schaefer Subject: Re: ${a[(i)pattern]} if a=() In-reply-to: <200803181213.m2ICDULc004081@pws-pc.ntlworld.com> To: Zsh hackers list Message-id: <080318084728.ZM12523@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <200803181213.m2ICDULc004081@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "Re: ${a[(i)pattern]} if a=()" (Mar 18, 12:13pm) X-Virus-Scanned: ClamAV 0.91.2/6288/Tue Mar 18 11:43:22 2008 on bifrost X-Virus-Status: Clean On Mar 18, 12:13pm, Peter Stephenson wrote: } } I've read through the manual again, and you're right, the sense of it is } it should be one, because it's "off the end". As Stephane pointed out, } zero looks screwy here (whatever the arguments about validity of } indices). So you should commit the patch. Done. Looking at documenation for this, I was reminded about this recent bit: Note that in subscripts with both `r' and `R' pattern characters are active even if they were substituted for a parameter (regardless of the setting of GLOB_SUBST which controls this feature in normal pattern matching). It is therefore necessary to quote pattern characters for an exact string match. Maybe we could press the (e) flag into service here? I haven't looked at how hard that would be to do, but it's semantically similar to the existing use: e This flag has no effect and for ordinary arrays is retained for backward compatibility only. For associative arrays, this flag can be used to force * or @ to be interpreted as a single key rather than as a reference to all values. This flag may be used on the left side of an assignment.