From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9787 invoked from network); 10 Jun 1998 06:47:59 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 10 Jun 1998 06:47:59 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id CAA01148; Wed, 10 Jun 1998 02:39:54 -0400 (EDT) Resent-Date: Wed, 10 Jun 1998 02:39:54 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980609234035.ZM9588@candle.brasslantern.com> Date: Tue, 9 Jun 1998 23:40:35 -0700 In-Reply-To: <199806092011.VAA05499@taos.demon.co.uk> Comments: In reply to Zefram "Re: ${=variable} doesn't always produce an array -- why?" (Jun 9, 9:11pm) References: <199806092011.VAA05499@taos.demon.co.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: Zefram Subject: Re: ${=variable} doesn't always produce an array -- why? Cc: zsh-workers@math.gatech.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"_7RR72.0.tH.veYVr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4077 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Jun 9, 9:11pm, Zefram wrote: } Subject: Re: ${=variable} doesn't always produce an array -- why? } } Bart Schaefer wrote: } >zsh% one="one" } >zsh% two="one two" } >zsh %echo ${${=one}[1]} ${${=two}[1]} } >o one } > } >This seems unintuitive to me. I was expecting to get the entire word "one" } >in both cases. } } Ceteris paribus, I'd agree with your analysis of the above situation. } But to have ${one[1]} expand to "one" when SH_WORD_SPLIT is enabled } might be considered worse. Hrm. I'm not so sure that -would- be worse. If it were done that way, then you'd get csh/ksh scalar behavior when emulating csh or ksh or sh, -and- $=x would always "make an array" of x. } OTOH, I've been thinking that it might be better to adopt the ksh view } of scalar variables, that they are actually arrays of a single element. No, to do that all the time would break way too many things, including most of the useful things you can do with $BUFFER in zle widgets and a whole lot of the sample compctl -K functions. The first idea (tying it to SH_WORD_SPLIT), on the other hand, probably won't do all that much harm; how many scripts that rely on SH_WORD_SPLIT also require zsh scalar-indexing behavior? Can we see a show of hands? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com