Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: What's the reasoning behind z & s returning nular for empty input?
- X-seq: zsh-users 24414
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: What's the reasoning behind z & s returning nular for empty input?
- Date: Sat, 9 Nov 2019 09:22:18 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GAUhLP1dcFp2cR6VkhUqmEsLrp+WFEjxpDKb8tBe16E=; b=q9uXAyKNGlilOqF/yEI7euMUtNcgTMGFlDmaSW55Q8WbuPtygW0dNwgQv81emcT7cs SKRpumF9D1XdiXJHw1Bx7QjUMu3RIodEOu67Z3shYF+bJyIWCs/fNWTL9I5GEHsSANQ6 1Vy53cxz67txub9mJWq6/AkNLN0JobPE01qQ0R4JuUBaJtTYmiNvl82EXBQ6nBoHkUB/ 30VO2+Fo8zaP3umzKTBsZWysGf3fHNnV6rSQc+bP+TvDcCLETyCP9J+yuznKhCmQMTZ4 2kLsitgJ6c294YS1KIFdywm7CVbDXUWXyxgT0c+s61GMBIAORvmRGOpmgeYIujgmDUjt 0VwQ==
- In-reply-to: <CAKc7PVCArzvg+Tmqwo7xQwYjBSz8sEnJwYPjZ=T0BETHsYsjXQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCD7e=vATDBc7px1d4XNYiKu1=2iZP9YaJ5PutgsDTsoQ@mail.gmail.com> <CAN=4vMpj91iZzOgLNNcUzb4UuTDEAiFxkjyuAa76hqqaQjnFBg@mail.gmail.com> <CAKc7PVCArzvg+Tmqwo7xQwYjBSz8sEnJwYPjZ=T0BETHsYsjXQ@mail.gmail.com>
On Sat, Nov 9, 2019 at 9:11 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> Thanks for the analysis. The additional problem is that quoted but
> @-lacking s-flag should still elide the empty elements, as the manual
> states. So this is an intentional exception and I wonder why it has
> been added?
Here's the passage from zshexpn:
For historical reasons, the usual behaviour that empty array
elements are retained inside double quotes is disabled for arrays
generated by splitting; hence the following:
line="one::three"
print -l "${(s.:.)line}"
produces two lines of output for one and three and elides the
empty field. To override this behaviour, supply the ‘(@)’ flag as
well, i.e. "${(@s.:.)line}".
The phrase "for history reasons" is used to describe past design
decisions and/or implementations that would be different if the
benefit of hindsight were available at the time, but changing which is
infeasible due to the existing code relying on the current behavior.
In other words, the current behavior is unfortunate but cannot be
changed.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author