Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Re: Associative array ordering and selective unset (Re: Example function)
- X-seq: zsh-workers 8265
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: Re: Associative array ordering and selective unset (Re: Example function)
- Date: Fri, 15 Oct 1999 08:13:08 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Thu, 14 Oct 1999 15:07:54 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> I almost implemented this a while ago, but I stopped because of this:
>
> } scanparamvals(HashNode hn, int flags)
> } {
> } + if (!(prog = patcompile(tmp, 0, NULL)) || !pattry(prog, scanstr))
> } + return;
>
> It just seemed so unpleasant to recompile the pattern for every key ...
Yep, I was a bit worried about this, too.
> I should probably clarify what I mean by that. In another post, I wrote:
>
> map=(
> '(*.(gz|Z)) zcat'
> '(*.bz2) bzip2 -dc'
> '(*.bz) bzip -dc'
> '(*) <'
> )
> eval 'for i do case $i in' ${(j( $i;; ))map} '$i;; esac done'
>
> Note that with this trick, all the patterns get compiled once (when the
> `case' is parsed) and then we can compare every $i to the "keys" without
> recompiling any patterns.
I had forgotten this message (and had the `(q)' thing in my todo list
and some spare time between holding exams).
Anyway, this reminds me that we still haven't tried to store
pre-compiled patterns in the execution trees for `case' and
`[[ .. = ..]]'...
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author