From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25455 invoked from network); 16 Nov 1998 13:27:37 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Nov 1998 13:27:37 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id IAA13997; Mon, 16 Nov 1998 08:16:59 -0500 (EST) Resent-Date: Mon, 16 Nov 1998 08:16:59 -0500 (EST) Date: Mon, 16 Nov 1998 14:15:02 +0100 (MET) Message-Id: <199811161315.OAA11069@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@math.gatech.edu In-reply-to: "Bart Schaefer"'s message of Mon, 16 Nov 1998 04:43:45 -0800 Subject: Re: Associative arrays and memory Resent-Message-ID: <"p8Hyz.0.eQ3.BN2Ks"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4650 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bart Schaefer wrote: > ... > > On Nov 16, 10:54am, Sven Wischnowsky wrote: > } Subject: Re: Associative arrays and memory > } > } (Every time I think about this I can't help remembering the discussion > } about a new option system, am I the only one?) > > You are not. However, I thought the "new options system" mainly meant > new syntax for "namespaces"? In which case it doesn't really help with > any of these questions about special parameters. It could remove one > level of indirection in the save/restore loops, I guess. > Yep. This is just another place where I could imagine assoc arrays to be used. > ... > > The problem (with or without your magic [(x)...] syntax) is that an > associative array is unordered, but presumably we want some fixed order > to the interpretation of completions when multiple patterns match the > command. (If we're using an associative array for completions, how do > you implement the equivalent of the -tc option?) Right, I forgot about that. > } (the question is: are there other uses > } where such a feature might be interesting to have > > I think for a shell-script-level feature, this has gone over the edge of > reasonable complexity. If perl doesn't have this feature, we should avoid > it too. :-} > > } and: if we have a > } way to get a list of matching entries, should we make this with a new > } modifier flag that can be combined with `i', `I', `r', and `R' so that > } all of them give a list, not only the first matching one?). > > Maybe it's because it's 4:30am, but I don't understand that part at all. I was thinking about something like the `g' history modifier: % typeset -A foo % foo[a]=hello % foo[b]=world % echo $foo[(i)?] a % echo $foo[(r)*l*] hello % echo $foo[(xi)*l*] a b % echo $foo[(xr)*l*] hello world As a side effect, we could use `$foo[(xi)*]' instead of `${(k)foo}' but the latter would still be faster. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de