Zsh Mailing List Archive
Messages sorted by:
Re: More rabbit-holes with unset variables
- X-seq: zsh-workers 47646
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: More rabbit-holes with unset variables
- Date: Thu, 26 Nov 2020 13:13:23 -0800
- Archived-at: <https://zsh.org/workers/47646>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-11/CAH%2Bw%3D7bxavq4DMJtTmSAGTOSoXKsFaXPVyUAGqN1cZLF%3D%2B57JQ%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-ot1-f45.google.com) smtp.remote-ip=22.214.171.124; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=iXjh2T0bkMHfuLJVCjCEFP0QCSDCO4VQ2FlAT7GFOMc=; b=0BINu/acMoz9QpZJ00W7OSkPobp8YhNWiIx84bUUhNP93/roTCJVnCIbkRa1Gn6OA7 nj3wUkARrqHc8nvPTZSuFmvGLO0Fr3TPu1UJivoF+nYApukMxYrIkKJNqAg0xgc1tGs4 +cjzPpbE3C4zJvfeDSRg6QdcZRVkvq14L2Va7vaBP8HwJH52Ye+3CXpfh/biYYqpVMXI P3g4/KB3Tq/dyNrZhWpAmVmlNC1u7Gskbxvd6sJTFKakMo4f3BG+ErE7R+HxqezK8mz9 a+jnFqg9CpvRvc2uClivF3ShZdj3Hcgvoc0hImRrQqNowcpSZQfiz1AsqCeRhSnYdMpA thDw==
- In-reply-to: <86243-1606389706.499549@-gQx.nNYG.4Z3k>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:email@example.com?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:firstname.lastname@example.org>
- List-post: <mailto:email@example.com>
- List-subscribe: <mailto:firstname.lastname@example.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:email@example.com?subject=unsubscribe%20zsh-workers>
- References: <CAH+w=7Zag5MG5D=cRS2UMSsqJ0t=iw5MH9j8=HBO1Q77nbs03w@mail.gmail.com> <firstname.lastname@example.org> <CAMP44s0-ki=TBzTwnqx10FcTLX4mbphwN88UCx0+h97JTecBWA@mail.gmail.com> <email@example.com> <CAMP44s1XgxdDAAL+7nL3_GK=dZUasPmSWZaKqWg0T-v5iq1eYg@mail.gmail.com> <86243-1606389706.499549@-gQx.nNYG.4Z3k>
- Sender: zsh-workers-request@xxxxxxx
On Thu, Nov 26, 2020 at 3:22 AM Oliver Kiddle <opk@xxxxxxx> wrote:
> 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.
Neither is a variant of the other; "export" is an alias for "typeset
-xg" that happens to be implemented as a reserved word.
> 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.
It doesn't export the empty string at the time the parameter is
declared, but it does consistently set it to empty string internally:
% Src/zsh -f
% export FOOBAR
% typeset -p FOOBAR
If it were NOT set, as after "unset FOOBAR", then "typeset -p" would
> It does make the KSH_TYPESET option somewhat less appropriate because
> this effect also applies to sh emulation.
We could do this when EMULATION(EMULATE_KSH|EMULATE_SH) instead of on an option.
If we are in fact limiting it to variables with no "strong type" type
then it really is sufficient to create an unset variable, except that
we somehow have to signal to "typeset -p" that it should print the
declaration even though the variable appears to be unset.
The latter raises the question of whether we want the Bash behavior of
continuing to print the declaration even after an explicit "unset",
which differs from ksh (cf. my first message in this thread).
Messages sorted by: