From: Stephane Chazelas <stephane@chazelas.org>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
Bart Schaefer <schaefer@brasslantern.com>,
Millian Poquet <millian.poquet@irit.fr>,
zsh-workers@zsh.org
Subject: Re: Get cursor position (Was: [bug report] prompt can erase messages written on the terminal by background processes)
Date: Thu, 8 Dec 2022 10:10:54 +0000 [thread overview]
Message-ID: <20221208101054.blcqkahcmb3mtdgq@chazelas.org> (raw)
In-Reply-To: <20221208100215.k2qcqdqgjlzwbdh7@chazelas.org>
2022-12-08 10:02:15 +0000, Stephane Chazelas:
[...]
> (bash does by exploiting some bug (calling unset -v in a
> severate function peels one layer of scoping instead of
> unsetting in the current scope)).
[...]
Not sure how "separate" became "severate" there. Sometimes it
feels like my fingers have a life of their own... Sorry.
unlocal in bash (or yash) can be written:
unlocal() { unset -v "$@"; }
(that's one of the main reasons POSIX couldn't specify "local"
btw).
It's worse in mksh where unset is always unlocal.
$ bash -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g: 1
f: 3
$ yash -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g: 1
f: 3
$ zsh -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g:
f: 1
$ dash -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g:
f: 1
$ bosh -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g:
f: 1
--
Stephane
next prev parent reply other threads:[~2022-12-08 10:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 19:02 [bug report] prompt can erase messages written on the terminal by background processes Millian Poquet
2022-12-07 22:55 ` Roman Perepelitsa
2022-12-08 3:46 ` Bart Schaefer
2022-12-08 8:21 ` Get cursor position (Was: [bug report] prompt can erase messages written on the terminal by background processes) Stephane Chazelas
2022-12-08 8:34 ` Roman Perepelitsa
2022-12-08 10:02 ` Stephane Chazelas
2022-12-08 10:10 ` Stephane Chazelas [this message]
2022-12-08 10:19 ` Mikael Magnusson
2022-12-09 2:19 ` Bart Schaefer
2022-12-09 12:46 ` Philippe Altherr
2022-12-10 4:30 ` Bart Schaefer
2022-12-10 14:55 ` Private variables not private enough? (Was: Get cursor position (Was: [bug report] prompt can erase messages written on the terminal by background processes)) Philippe Altherr
2022-12-10 17:36 ` Bart Schaefer
2022-12-10 20:38 ` Bart Schaefer
2022-12-11 18:00 ` Get cursor position (Was: [bug report] prompt can erase messages written on the terminal by background processes) Stephane Chazelas
2022-12-09 1:39 ` Bart Schaefer
2022-12-08 8:45 ` [bug report] prompt can erase messages written on the terminal by background processes Roman Perepelitsa
2022-12-08 15:03 ` Oliver Kiddle
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=20221208101054.blcqkahcmb3mtdgq@chazelas.org \
--to=stephane@chazelas.org \
--cc=millian.poquet@irit.fr \
--cc=roman.perepelitsa@gmail.com \
--cc=schaefer@brasslantern.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).