Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: subscript flags on lhs of assignment
- X-seq: zsh-workers 19713
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: PATCH: subscript flags on lhs of assignment
- Date: Wed, 31 Mar 2004 15:58:40 +0000
- In-reply-to: <15526.1080739251@xxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <15526.1080739251@xxxxxxxxxxxxxxxxxxxxx>
On Mar 31, 3:20pm, Oliver Kiddle wrote:
}
} The SCANPM_MATCHMANY flag also seems to get set for the (k)
} flag. Is that a bug?
No, it's a hack to work around another shortcoming. In order to use the
keys as the search patterns, I had to pretend to be interested in all
the keys, even though only one of them will eventually be used to return
a matching element. Or something to that effect, it's been a very long
time since I wrote that code.
} There may well be better ways to implement this. Using the (k), (i) and
} (r) flags seems to result in one element arrays instead of single
} values
I believe that's because, for "normal" arrays, you can do slices with two
patterns e.g. $array[(r)left,(i)right].
It's because they return one-element arrays that assignments previously
didn't work for associatives.
} This seems to work and is fairly minimal
Nice. You'll need to update the docs, of course; the INability to use
a pair of patterns for associative arrays should have been explicitly
mentioned before, and the stuff about assignments not working will have
to move from the "r" section to the "R" section.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author