Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${a[(i)pattern]} if a=()
- X-seq: zsh-workers 24724
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: ${a[(i)pattern]} if a=()
- Date: Tue, 18 Mar 2008 08:47:28 -0700
- In-reply-to: <200803181213.m2ICDULc004081@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <200803181213.m2ICDULc004081@xxxxxxxxxxxxxxxxxxx>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author