From: Oliver Kiddle <opk@zsh.org>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: More rabbit-holes with unset variables
Date: Thu, 26 Nov 2020 12:21:46 +0100 [thread overview]
Message-ID: <86243-1606389706.499549@-gQx.nNYG.4Z3k> (raw)
In-Reply-To: <CAMP44s1XgxdDAAL+7nL3_GK=dZUasPmSWZaKqWg0T-v5iq1eYg@mail.gmail.com>
The original Bourne shell did I believe have both export and the
${...-...} form. Using /bin/sh from Solaris (available for Linux as
heirloom sh):
export FOO
echo ${FOO-replacement}
Will output the replacement.
It appears that export VAR will not export an empty VAR even in zsh
(unless you do VAR=""). So zsh's not exactly consistent.
typeset [-x] is arguably just a variant of export.
This does change how I regard zsh's behaviour. It isn't zsh taking a
different but equally valid approach on an extension but an sh
incompatibility. It once was a bug even if now too entrenched.
Zsh's behaviour is long-standing - I've even checked 2.5.03. And it is
well-defined behaviour so declaring it a feature is an option.
It does make the KSH_TYPESET option somewhat less appropriate because
this effect also applies to sh emulation.
But if we decide to "fix" it for zsh, I don't think it'll break too much.
Given that empty values are rarely especially useful, I've always used
the :- form. If the change sits in git for a reasonable time, we might
find out how much it might break.
I did reply on the initial thread but the References: header hit
a mail server limit for line length and it failed.
So I've covered my main point but just to pick out something from this
thread:
Felipe Contreras wrote:
> The discussion is about what "typeset var" (with no type) should do.
That is not "with no type", it has the default type which effectively is
a string. Other shells also treat such variables as an empty string for
the purposes of other features. Try += for example.
Oliver
next prev parent reply other threads:[~2020-11-26 11:22 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 7:02 Bart Schaefer
2020-11-25 13:19 ` Stephane Chazelas
2020-11-25 22:17 ` Felipe Contreras
2020-11-26 6:10 ` Stephane Chazelas
2020-11-26 7:20 ` Felipe Contreras
2020-11-26 11:21 ` Oliver Kiddle [this message]
2020-11-26 11:29 ` Roman Perepelitsa
2020-11-26 19:08 ` Felipe Contreras
2020-11-26 19:29 ` Felipe Contreras
2020-11-26 21:13 ` Bart Schaefer
2020-11-26 21:31 ` Felipe Contreras
2020-11-26 23:29 ` Bart Schaefer
2020-11-26 23:32 ` Bart Schaefer
2020-11-26 23:53 ` Felipe Contreras
2020-11-27 0:23 ` Bart Schaefer
2020-11-27 1:51 ` Felipe Contreras
2020-11-27 20:01 ` Bart Schaefer
2020-11-27 21:49 ` Felipe Contreras
2020-11-27 22:06 ` Bart Schaefer
2020-11-27 23:35 ` Felipe Contreras
2020-11-26 22:07 ` Bart Schaefer
2020-11-26 20:41 ` Bart Schaefer
2020-11-26 20:49 ` Stephane Chazelas
2020-11-26 21:20 ` Felipe Contreras
2020-11-26 22:41 ` Bart Schaefer
2020-11-26 23:45 ` Felipe Contreras
2020-11-27 0:09 ` Bart Schaefer
2020-11-27 0:30 ` Felipe Contreras
2020-11-27 0:51 ` Bart Schaefer
2020-11-27 1:30 ` Felipe Contreras
2020-11-27 20:54 ` Bart Schaefer
2020-11-27 22:10 ` Felipe Contreras
2020-11-27 22:39 ` Bart Schaefer
2020-11-28 0:00 ` Felipe Contreras
2020-11-28 0:04 ` Bart Schaefer
2020-11-28 10:52 ` Felipe Contreras
2020-11-28 0:36 ` The emulation rabbit-hole RE typeset/unset Bart Schaefer
2020-11-28 11:35 ` Felipe Contreras
2020-11-28 16:56 ` Bart Schaefer
2020-12-01 8:49 ` Felipe Contreras
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=86243-1606389706.499549@-gQx.nNYG.4Z3k \
--to=opk@zsh.org \
--cc=felipe.contreras@gmail.com \
--cc=zsh-workers@zsh.org \
/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).