Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Change in FIGNORE behavior

On Wed, 30 May 2007 13:54:36 +0100
Peter Stephenson <pws@xxxxxxx> wrote:
> Index: Doc/Zsh/params.yo
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
> retrieving revision 1.37
> diff -u -r1.37 params.yo
> --- Doc/Zsh/params.yo	21 May 2007 09:30:25 -0000	1.37
> +++ Doc/Zsh/params.yo	30 May 2007 12:50:00 -0000
> @@ -234,7 +234,10 @@
>  Like `tt(r)', but gives the last match.  For associative arrays,
> gives all possible matches. May be used for assigning to ordinary
> array elements, but not for assigning to associative arrays.
> -On failure the empty string is returned.
> +On failure the empty string is returned for a single match; any
> +time a valid subscript is needed (for example, on an assignment
> +to a failed element, or in a subscript range) the subscript is
> +treated as the location of the first element.
>  )
>  item(tt(i))(
>  Like `tt(r)', but gives the index of the match instead; this may not

Any strong reaction to this further change for (R)?  I'm tempted to put it
in in the hope it's the best of a bad job.

I think the ideal case would be that a failed (R) returned an index off the
beginning of the array.  This would make it symmetrical with (r), would
make ranges work sensibly, and would make an assignment on failure prepend
the quantity being assigned (rather than override the first element, which
is pretty gross).  However, with the kludge for index 0 as a poor person's
KSH_ARRAYS, and negative numbers counting from the end, there is no index
that's off the start.  The combination of (R) returning an empty element if
it's returning an element, and the start of the array if it's being used as
an index, including the case of ranges and assignments (and, as it will no
doubt turn out, roads, schools, aqueducts, ...) mimics that to some extent.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview

Messages sorted by: Reverse Date, Date, Thread, Author