From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Zefram <zefram@tao.co.uk>
Cc: zsh-workers@math.gatech.edu
Subject: Re: ${=variable} doesn't always produce an array -- why?
Date: Tue, 9 Jun 1998 23:40:35 -0700 [thread overview]
Message-ID: <980609234035.ZM9588@candle.brasslantern.com> (raw)
In-Reply-To: <199806092011.VAA05499@taos.demon.co.uk>
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
prev parent reply other threads:[~1998-06-10 6:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-06-09 19:41 Bart Schaefer
1998-06-09 20:11 ` Zefram
1998-06-10 6:40 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=980609234035.ZM9588@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zefram@tao.co.uk \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).