From: Zefram <zefram@tao.co.uk>
To: schaefer@brasslantern.com (Bart Schaefer)
Cc: zsh-workers@math.gatech.edu
Subject: Re: ${=variable} doesn't always produce an array -- why?
Date: Tue, 9 Jun 1998 21:11:34 +0100 (BST) [thread overview]
Message-ID: <199806092011.VAA05499@taos.demon.co.uk> (raw)
In-Reply-To: <980609124159.ZM6845@candle.brasslantern.com> from "Bart Schaefer" at Jun 9, 98 12:41:58 pm
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.
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.
That would make ${one[1]} in the above unambiguously refer to "one",
and make $= behave as you expected. It would also break a lot of
existing scripts in ways that could only partially be fixed by another
compatibility option.
-zefram
next prev parent reply other threads:[~1998-06-09 20:15 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 [this message]
1998-06-10 6:40 ` Bart Schaefer
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=199806092011.VAA05499@taos.demon.co.uk \
--to=zefram@tao.co.uk \
--cc=schaefer@brasslantern.com \
--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).