Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: One possible answer to typeset vs. unset
- X-seq: zsh-workers 47698
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: One possible answer to typeset vs. unset
- Date: Sat, 28 Nov 2020 12:00:46 -0800
- Archived-at: <https://zsh.org/workers/47698>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-11/CAH%2Bw%3D7Z284OFbHkf7K0cGmD0v69M8vXuosAYkBbfJx6z5TSkZQ%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-oi1-f172.google.com) smtp.remote-ip=209.85.167.172; 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=x5PivNItnzKz7SN4byPwEsUYa8R2RV+SLkRpn8KD6Pc=; b=I7Qlc/gTpWkf9YIqu5TqAdVHK7LjXT4780wTTv8A/MGdE884dC0xd13Yifdsa8MhMx PXzKL4aEAHIyv8f6v4/PvedHAozdW5MId1GHcGB87gQe48jFXzvKszy3r1PmBpwim+2n M29IE3q85bCrttuTEoY3IhgDb7DDDR9huItWYHFRcaaaaXOjowF7n4NzPS1aKMCnwt8F EaKF2sndfvvT0gjBbO/24dxK5Cpee2XgOrBdEP1QmjlpIqQ3075Mcw6eF377OAee2soC fc62mOX3S4i8KreSuZXElIwhKmghTcSWICl+c9BDVXCfwkigvYRwjADOwvCkCU3RH+pU F3iQ==
- In-reply-to: <CAH+w=7Zh8URUiLF2n1x-ZrvKO+=JC8wf+n692sRsFTRbkJrzXw@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <CAH+w=7Zh8URUiLF2n1x-ZrvKO+=JC8wf+n692sRsFTRbkJrzXw@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
On Sat, Nov 28, 2020 at 11:49 AM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> A typeset variable with no assignment triggers NO_UNSET warnings when
> the name is used in parameter expansion or math.
There are a couple of possible ways to amend this.
The most radical would be for "typeset foo" to fail when NO_UNSET,
thus forcing all declarations to assign explicit defaults.
The other way would be to test the PM_DECLARED flag and treat the
variable as if set. This could cause problems for (at least) numeric
types, because $num returns empty string rather than zero, which is
exactly the sort of thing you want NO_UNSET to alert you about.
So the right thing is most likely no amendment at all.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author